Unified Search Form
UPDATE (12/04/05) —
Version 2.0 — I have changed the way the Unified Search Form works. The first block of code here is the new version (identical to the one on the left side of my page). I have left the code for the old version at the bottom of this post. Please feel free to adapt either the new or old version of the Unified Search Form to your uses. NB: please copy the image for the search buttons to your own site. Here it is:
…or you can find your own image to use.
<font size="+1">Search</font> <font size="-3">(<a href="http://www.aaronlogan.com/blog/archives/2004/04/28/141">Get this form</a>)</font><br />
<form action="http://www.yoursite.com/blog/index.php" method="get" />
<input type="text" size="15" name="s" value="type query" onFocus="value=''" /><br />
<input type="image" src="http://www.yoursite.com/images/misc/submit.gif" vspace="2" hspace="4" align="center" onClick="action=’http://www.yoursite.com/blog/index.php’; method=’get’; s.name=’s’;" />this blog<br />
<input type="image" src="http://www.yoursite.com/images/misc/submit.gif" vspace="2" hspace="4" align="center" onClick="action=’http://www.lightmatter.net/gallery/search.php’; method=’get’; s.name=’searchstring’; photos.x=’1′; photos.y=’1′;" />my photos<br />
<input type="image" src="http://www.yoursite.com/images/misc/submit.gif" vspace="2" hspace="4" align="center" onClick="action=’http://www.bugmenot.com/view.php’; method=’get’; s.name=’url’;" />bugmenot<br />
<input type="image" src="http://www.yoursite.com/images/misc/submit.gif" vspace="2" hspace="4" align="center" onClick="action=’http://dictionary.reference.com/search’; method=’get’; s.name=’q'; " />dictionary<br />
<input type="image" src="http://www.yoursite.com/images/misc/submit.gif" vspace="2" hspace="4" align="center" onClick="action=’http://del.icio.us/search/’; method=’get’; s.name=’all’; " />del.icio.us<br />
<input type="image" src="http://www.yoursite.com/images/misc/submit.gif" vspace="2" hspace="4" align="center" onClick="action=’http://search.ebay.com/search/search.dll’; method=’get’; s.name=’satitle’;" />eBay<br />
<input type="image" src="http://www.yoursite.com/images/misc/submit.gif" vspace="2" hspace="4" align="center" onClick="action=’http://www.froogle.com/froogle’; method=’get’; s.name=’q';" />froogle<br />
<input type="image" src="http://www.yoursite.com/images/misc/submit.gif" vspace="2" hspace="4" align="center" onClick="action=’http://www.google.com/search’; method=’get’; s.name=’q';" />google<br />
<input type="image" src="http://www.yoursite.com/images/misc/submit.gif" vspace="2" hspace="4" align="center" onClick="action=’http://maps.google.com/maps’; method=’get’; s.name=’q';" />google maps<br />
<input type="image" src="http://www.yoursite.com/images/misc/submit.gif" vspace="2" hspace="4" align="center" onClick="action=’http://scholar.google.com/scholar’; method=’get’; s.name=’q';" />google scholar<br />
<input type="image" src="http://www.yoursite.com/images/misc/submit.gif" vspace="2" hspace="4" align="center" onClick="action=’http://www2.merriam-webster.com/cgi-bin/mwmednlm’; method=’get’; s.name=’va’;" />med dictionary<br />
<input type="image" src="http://www.yoursite.com/images/misc/submit.gif" vspace="2" hspace="4" align="center" onClick="action=’http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?CMD=search&DB=pubmed’; method=’post’; s.name=’term’;" />pubmed<br />
<input type="image" src="http://www.yoursite.com/images/misc/submit.gif" vspace="2" hspace="4" align="center" onClick="action=’http://www.rottentomatoes.com/search/full_search.php’; method=’get’; s.name=’search’;" />rotten tomatoes<br />
<input type="image" src="http://www.yoursite.com/images/misc/submit.gif" vspace="2" hspace="4" align="center" onClick="action=’http://www.whois.sc/domain-suggestions/’; method=’get’; s.name=’q';" />whois<br />
<input type="image" src="http://www.yoursite.com/images/misc/submit.gif" vspace="2" hspace="4" align="center" onClick="action=’http://en.wikipedia.org/w/index.php’; method=’get’; s.name=’search’;" />wikipedia<br />
</form>
***** ***** *****
BELOW IS THE OLD VERSION OF THE UNIFIED SEARCH FORM WHICH EMPLOYED RADIO BUTTONS AND LOOKED LIKE THIS:
Search (Get this form)
this blog my photos google dictionary wikipedia whois
This is set up to default to searching your site. If your site uses a name other than “s” for the search variable, you’ll want to change that at each appropriate location (everywhere it is underlined here).
<script type="text/javascript" language="javascript">
function runquery() {
if (document.searchform.rb[0].checked == true) {
document.searchform.action=’http://www.mysite.com/blog/index.php’;
document.searchform.method=’get’;
document.searchform.s.name=’s‘;
}
if (document.searchform.rb[1].checked == true) {
document.searchform.action=’http://www.mysite.com/gallery/search.php’;
document.searchform.method=’get’;
document.searchform.s.name=’searchstring’;
}
if (document.searchform.rb[2].checked == true) {
document.searchform.action=’http://www.google.com/search’;
document.searchform.method=’get’;
document.searchform.s.name=’q';
}
if (document.searchform.rb[3].checked == true) {
document.searchform.action=’http://dictionary.reference.com/search’;
document.searchform.method=’get’;
document.searchform.s.name=’q';
}
if (document.searchform.rb[4].checked == true) {
document.searchform.action=’http://en.wikipedia.org/w/wiki.phtml’;
document.searchform.method=’post’;
document.searchform.s.name=’search’;
}
if (document.searchform.rb[5].checked == true) {
document.searchform.action=’http://www.whois.sc/domain-suggestions/’;
document.searchform.method=’get’;
document.searchform.s.name=’q';
}
return true;
}
</script>
Search <font size="-3">(<a href="http://www.aaronlogan.com/blog/archives/2004/04/28/141">Get this form</a>)</font><br />
<form name="searchform" action="http://www.mysite.com/blog/index.php" method="get" onSubmit="return runquery();" />
<input type="text" size="11" name="s" value="" /> <input type="submit" onClick="return runquery();" value="Go" /><br />
<input name="rb" type="radio" value="0" checked="checked"/>this blog<br />
<input name="rb" type="radio" value="1" />my photos<br />
<input name="rb" type="radio" value="2" />google<br />
<input name="rb" type="radio" value="3" />dictionary<br />
<input name="rb" type="radio" value="4" />wikipedia<br />
<input name="rb" type="radio" value="5" />whois<br />
</form>