| This script uses a onClick event handler in the button <INPUT> tag to change the current document.location to the value set by the form named gotolocation using the <SELECT NAME="dropdown"> tag's selectedIndex
A closer examination of the complete statement may help in understanding how this is done.
document.location = document.gotolocation.dropdown.options[document.gotolocation.dropdown.selectedIndex].value;"
The first section, document.location, is the current location of the browser.
document.gotolocation.dropdown.options[document.gotolocation.dropdown.selectedIndex].value;
This next section will need a little breaking down in order to follow it easily. The first part, document, refers to the currently displayed HTML document.
gotolocation is the name that was given to the entire form.
dropdown is the name of the <SELECT NAME="dropdown"> field of the form.
selectedIndex refers to the <OPTION> that was chosen.
and finally, the last segment, value, refers to the value that was set in the <OPTION> tag.
So that great long string of code was used to pick out the URL set in the drop down menu and set the current page to that value.
|