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!

Creating a 'Google" search for your site.

Javascript Search Engine

Creating a 'Google" search for your site.

by  GUJUm0deL  Posted    (Edited  )
A lot of people have asked how to have a search engine on their site that searches the entire website, kind of like Google, Yahoo, MSN does. Well, here you go.


[color red]
Code:
<html>
<head>
<title>Google Search</title>
<meta name="author" content="GUJUm0deL">

<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.")
	document.doingasearch.searchbox.focus();
  }
}
</SCRIPT>
</head>

<body bgcolor="#FFFFFF">
<table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><div align="center">Type any search criteria in the textfield and this 
        will search it on google. <br>
        <br>
        <em>Search results opens in a new window.</em></div></td>
  </tr>
  <tr>
    <td>á</td>
  </tr>
  <tr>
    <td>
    <FORM name="doingasearch" id="doingasearch">
   Google  
  <INPUT name=searchbox type=text size=20>
  <INPUT type="button" value="Search" onclick="return googleSearch();">
</FORM>
    </td>
  </tr>
  <tr>
  <td>For more scripts visit <a>http://www.imajinarts.com/downloads.cfm</a>
  </td>
  </tr>
</table>
</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