Javascript jump box

Sometime you want to automatically do something when people selecting an option from a combo box. Here is the HTML + js code

1
2
3
4
5
6
7
<form name="form">
<select name="mybox" onchange="window.location.href=this.options[this.selectedIndex].value;">
     <option selected>Please Select
     <option value="http://www.example.com/">example site
     <option value="http://www.google.com/">google site
</select>
</form>

If want to open it in new window just change the window.location.href to window.open(xxx)

Leave a Reply

Your email address will not be published. Required fields are marked *