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?
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?