[TuT] JavaScript Search Engine Search

KilkKilk Junior MemberShared Hoster
Tutorial on a Javascript Search Engines Search-

Just simply add the below code to your webpage and there is your working search engines search

Change the "YOURSITEHERE.com" to exactly where the file with this code is at

<script language="JavaScript" 
        type="text/javascript">
<!--
// Carsen Klock's Search Engine Javascript
function startSearch(){searchString = document.searchForm.searchText.value;
if(searchString != ""){searchEngine = document.searchForm.whichEngine.selectedIndex + 1;finalSearchString = "";
if(searchEngine == 1){finalSearchString = "YOURSITEHERE.com";}
if(searchEngine == 2){finalSearchString = "http://http://www.google.com/search?q=" + searchString;}
if(searchEngine == 3){finalSearchString = "http://www.altavista.com/web/results?itag=ody&q=" + searchString;}
if(searchEngine == 4){finalSearchString = "http://http://search.msn.com/results.aspx?q=" + searchString;}
if(searchEngine == 5){finalSearchString = "http://http://search.yahoo.com/search?p=" + searchString;}
if(searchEngine == 6){finalSearchString = "http://http://www.ask.com/web?q=" + searchString;}
if(searchEngine == 7){finalSearchString = "http://http://www.dogpile.com/info.dogpl/search/web/" + searchString;}
if(searchEngine == 8){finalSearchString = "http://download.cnet.com/downloads/1,10150,0-10000-103-0-1-7,00.html?tag=srch&qt=" + searchString;}
location.href = finalSearchString;}
}// -->
</script>

<font color=white><form name="searchForm"
    method="get">
<b>Find</b><input name="searchText"
      maxlength="125"
      type="text"> <b>With</b></color>
<select name="whichEngine"
      onChange="startSearch()">
<option selected>
Select Engine
</option>

<option>
Google
</option>

<option>
Altavista
</option>

<option>
Msn
</option>

<option>
Yahoo!
</option>

<option>
Ask Jeeves
</option>

<option>
DogPile
</option>

<option>
Software - CNet Downloads
</option>
</select>
</form>

And wala, you can then search at Google or AskJeeves etc. directly from your site!
Sign In or Register to comment.