Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to have a web search box on your site...

Searching Google...

How to have a web search box on your site...

by  GUJUm0deL  Posted    (Edited  )
Many times people need a web search on their site (not a site-search, but a search engine for Google, Yahoo, Excite, etc...)
Well, this little script does a search for Google, and opens the results in a new window...
Pretty neat huh??
[color red]
<html>
<head>

<SCRIPT LANGUAGE=JAVASCRIPT>
function googleSearch() {
if (document.doingasearch.searchbox.value!="") {
window.open("http://www.google.com/search?hl=en&q=" + document.doingasearch.searchbox.value) ;
}
else {
alert("Please enter something to search.")
}
}
</SCRIPT>
</head>

<body bgcolor="#FFFFFF">
<FORM name="doingasearch" id="doingasearch">
Google
<INPUT name=searchbox type=text size=20>
<INPUT type="button" value="Search" onclick="return googleSearch();">
</FORM>
</body>
</html>
[/color]
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top