Please note that JavaScript is currently only available in Netscape Navigator 2.0 or higher.
Do not assume that all in your audience are using a JavaScript enabled browser.
How to use
The source of the popup menu looks like this:
Change the links and text to be displayed in the menu by editing the lines containing the
OPTION
tags. Note that you can also use full URL's in the VALUE attribute.Change the text of the button in the Value attribute of
<INPUT TYPE=BUTTON VALUE="Go"
...
Programming notes
The actual JavaScript is in the button's onClick handler. The JavaScript arraythis.form.menu.options
is an array of the option tags (with its contents) in the form named "menu". To find which menu item that is selected we can use the propertythis.form.menu.selectedIndex
, that holds the index of the selected item.We then get the name of the page by accessing the value attribute of the selected item in the array with the expression
this.form.menu.options[this.form.menu.selectedIndex].value
.
top.location.href
is the address of the url to be displayed in the window. Since we settop.location
to contain the new pages URL, the new page will be displayed in the entire window, even if our page is inside a frame. To get a page to be displayed in a specific frame is an exercise left to the reader ;-).