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

Jump menu - image button not working

Status
Not open for further replies.

spastica

Programmer
Sep 27, 2002
72
0
0
GB
I am trying to create a select box dropdown menu. Upon click of the go button, the user will be taken to the url selected in the option list.

The problem is, I'm using an image for the go button, instead of an actual button, and the following script isn't working. It's concatenating the url selected onto the existing url in the address bar (as a querystring), instead of going to another page.

Here is the code:

<script language="javascript" type="text/javascript">
function changUrl(url)
{

window.location=url;
}

</script>

<input type="image" src="go.gif" onClick="javascript: changUrl(document.SearchForm.slcturl.options[document.SearchForm.slcturl.selectedIndex].value);" />

This works fine if I don't use an image for the button, and just set input type as "button".

Any suggestions on how to solve this problem?
 
image inputs submit the form. try using an image with a surrounding anchor...

Code:
<a href="#" onclick="changUrl(document.SearchForm.slcturl.options[document.SearchForm.slcturl.selectedIndex].value); return false;"><img src="go.gif" /></a>



*cLFlaVA
----------------------------
[tt]( <P> <B>)[sup]13[/sup] * (<P> <.</B>)[/tt]

[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top