Dropdown Form, when click on element, go to link without hitting a submit button
I have a dropdown form, and when the user clicks on an element I want them to go to the url I have in the code without hitting a submit button. Here is the code I have so far
<select name="mydropdown" class="styled" onChange="location=document.jump.menu.options[document.jump.menu.selectedIndex].value;" value="GO">
<option value="http://www开发者_如何学编程.cats.com">Select Your Compliance Center</option>
<option value="http://www.funcats.com">Fresh Milk</option>
<option value="http://cutecats.com">Old Cheese</option>
<option value="http://lolcats.com">Hot Bread</option>
</select>
but it doesn't seem to be working.
Any help would be greatly appreciated.
Use this:
<select name="mydropdown" class="styled" onChange="document.location = this.value" value="GO">
<option value="http://www.cats.com">Select Your Compliance Center</option>
<option value="http://cutecats.com">Old Cheese</option>
<option value="http://lolcats.com">Hot Bread</option>
</select>
More or less the same as the other answer, but this one goes through a form.
<form name="linkForm" method="POST" action="" id="form">
<select name="mydropdown" class="styled" onchange="document.getElementById('form').setAttribute('action', this.value); document.linkForm.submit(); ">
<option value="http://www.cats.com">Select Your Compliance Center</option>
<option value="http://www.funcats.com">Fresh Milk</option>
<option value="http://cutecats.com">Old Cheese</option>
<option value="http://lolcats.com">Hot Bread</option>
</select>
</form>
精彩评论