Forum Moderators: phranque

Message Too Old, No Replies

Search box?

         

Amanda

6:12 pm on Jul 17, 2007 (gmt 0)

10+ Year Member



I'm building a site and want to add a search box so visitors can type in phrases to find what they're looking for on my site only. Does anyone know how I can do this?

Marshall

6:22 pm on Jul 17, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Unless you have a built-in search feature, you will need aa search script. There are many to choose from (do web search) and since posting specific brands is against TOS, maybe check your stickymail now and then as people may send some info. I do have a "Search This Page" script if you're interested in that, otherwise, to put a search box on your site is this simple:


<form method="get" action="Search/search.asp">
<label for="search">Site Search:</label><br />
<input type="text" name="zoom_query" size="15" id="search" value="Site Search" onfocue="clearDefault(this)" />&nbsp; &nbsp;<input type="submit" value="Search!" />
</form>

You'll notice an "onfocus" command in the text input box. This clears any pre-defined "value" when the cursor is placed in the box. The script for that is:


<script type="text/javascript">
function clearDefault(el) {
if (el.defaultValue==el.value) el.value = ""
}
</script>

Also, here's a script if you want the cursor to start in the box automatically:


onload="document.emailform.name.focus()"

Replace 'emailform' with the name of your form and 'name' with the name of the field. Put the script in the <body> tag:


<body onload="document.emailform.name.focus()">

Hope this helps.

Marshall

[edited by: Marshall at 6:30 pm (utc) on July 17, 2007]

ebound

6:28 pm on Jul 17, 2007 (gmt 0)

10+ Year Member



Google SiteSearch - Free

[google.com...]

Google Custom Business Search $100 Per Year < 5000 Pages

[google.com...]

ebound

6:30 pm on Jul 17, 2007 (gmt 0)

10+ Year Member



There's more info on the search for business on the thread featured on the home page today:

[webmasterworld.com...]

dpd1

12:02 am on Jul 18, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've used the Google search and that's probably one of the easiest solutions... Plus you can use the AdSense search and make a few bucks. Only problem is that Google has to have indexed your whole site for it to work well.