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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Making a drop down box to search

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I have three favorite search engines that I like. How can I make a drop down box that I can use to search either of the three?
 
OK, That worked great! Thanks, but I have one more question. How can I make a box, so that I can type in the search criteria in, than I select the search engine that I want, then I click a search button, and it will search based on what I typed in.
 
OK, last question. I'm not very smart. How would I use that code to make it look like a search box on my web page? Like each time I go there, I want to type in a different search each time. Like Altavista for example.
 
this works in IE, NS4.X, and NS6:

<script>

function findIt()
{
var criteria,engine,search,frm;
frm = document.benlucbenluc
criteria = frm.benlucben.value;
engine = frm.benluc.options[frm.benluc.selectedIndex].value;
switch(engine)
{
case '1':
search=&quot; break;
case '2':
search=&quot; break;
case '3':
search=&quot; }
window.location=search
}
</script>

<form action=&quot;javascript:findIt()&quot; name=&quot;benlucbenluc&quot;>
Search for:&amp;nbsp;<input name=&quot;benlucben&quot;>&amp;nbsp;with
<select name=&quot;benluc&quot;>
<option value=&quot;1&quot;>Altavista
<option value=&quot;2&quot;>Yahoo
<option value=&quot;3&quot;>Web Crawler
</select>
<script>
if(document.all){document.write('<input type=&quot;submit&quot; value=&quot;Search&quot;>')}
else{document.write('<input type=&quot;button&quot; onClick=&quot;findIt()&quot; value=&quot;Search&quot;>')}
</script> jared@aauser.com
 
Oh yeah, please ask programming questions for client-side programming in the javascript or vbscript forum. :eek:) jared@aauser.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top