Drop Down Boxes: No ButtonDrop down boxes for navigation without clicking buttons
<SELECT name="sport" onChange="alert('I\'m glad YOU can make choices!')">
<OPTION SELECTED>--Choose a Sport--
You can try it out below. It isn't very useful, but it works....
Now, we can get to the useful application. You can use the onChange attribute to do the same thing that we did with the onClick in the button in the last section. In other words, the onChange attribute will now load the new url when someone makes a selection. A new sample drop box is below. Give it a try:
Other than removing the button and moving the window.location code to the onChange attribute in the Select tag, this is the same script:
<OPTION value="jex15.htm">Page 1
<OPTION value="jex16.htm">My Cool Page
Notice that the default option selected just tells you to choose something. It won't lead anywhere unless someone tries to change back to it. I used the url of the page it was on for the value of it, so the browser will stay on the same page if it gets selected later. This isn't likely to happen though. I couldn't go back and change back to the default option from another option when I tried. The browsers just went back and loaded the page with the default selection already selected again.
Well, there is your drop box with no button. Go change the urls and have some fun with it!
Well, that does it for now, try out the next section on
Drop Boxes and Frames.
||By: John Pollock||