Creating a combo menu that jumps to a URL upon selecting
In this final section of our tutorial, we'll see how to implement a rather jumpy add-on to a combo box- the ability to go to the specified URL in a combo box simply upon selecting it. The secret to making this happen lies in the onChange event handler. The onChange event handler is inserted inside the select tag, which reacts to the surfer changing the selection inside the combo box. Let's modify our old combo box so it jumps to a url this way. The revision is highlighted in red:
As you can see, all we really did here is add a onChange event to the select tag, which causes function go() to react as soon as the selection in the combo link box changes. Now, we still need the "Go!" button in this case. The onChange event handler only reacts if the selection has changed. If the user wants to go to the initially selected element, the"Go!" button has to be pressed.