I am trying to create a pull-down-search-engine-menu. It works fine when I use the standard submit button; however, I want to use an image button instead. Can somebody take a look and see where I’m going wrong? Thanks in advanced for your help.
[CODE]<script language=”javascript”>
function getit(form){
engine=document.search.engine.options
[document.search.engine.selectedIndex].value;
if (engine == “google”) engine = “http://www.google.com/search?hl=en&q=”;
if (engine == “excite”) engine = “http://www.excite.com/search.gw?trace=1&search=”;
if (engine == “msn”) engine = “http://search.msn.com/results.aspx?q=movies”;
if (engine == “aolnetfind”) engine = “http://netfind.aol.com/search.gw?c=web&lk=netfind&src=1&search=”;
if (engine == “yahoo”) engine = “http://search.yahoo.com/bin/search?p=”;
if (engine == “lycos”) engine = “http://www.lycos.com/cgi-bin/pursuit?matchmode=and&cat=lycos&x=232&y=111&query=”;
if (engine == “hotbot”) engine = “http://www.search.hotbot.com/?SW=web&SM=MC&DC=10&DE=2&act.search.x=115&act.search.y=167&MT=”;
if (engine == “looksmart”) engine = “http://www.looksmart.com/r?look=mp&search=1&key=”;
keywords = convert(document.search.keywords.value);
location= engine +keywords
}
function convert(input) {
var output = “”;
for (var i = 0; i < input.length; ++i) {
var temp = input.charAt(i); if (temp == ” “) temp = “+”;
output += temp;
}
return output;
}
// –>
</script>
<form method=post name=search>
<span id=”search”>
Search:
<select name=”engine”>
<option value=”google”>Google
<option value=”excite”>Excite
<option value=”msn”>MSN
<option value=”aolnetfind”>AOL Netfind
<option value=”yahoo”>Yahoo
<option value=”lycos”>Lycos
<option value=”hotbot”>Hot Bot
<option value=”looksmart”>Look Smart
</select>
<input type=text size=35 name=keywords>
<input type=”image” src=”images/go.jpg” value=Search onclick=getit(this.form)>
<input type=”image” src=”images/reset.jpg” value=”Reset” alt=”Reset”>
</form>