Choose A Page and Jump

Submitted by:Tim Kelly

Date added:28 January, 2012


JavaScript Code example to choose a page and Jump

Tags: jump

Code Snippet:

selectedIndex is the "Index number" that the user "chose"
notice that the <SELECT> tag has a bunch of options -- hence an Array of Options
the Options all have a value & that value is a URL
location.href = URL is where we will end up going to

<SELECT onChange="location.href=options[selectedIndex].value">
<OPTION VALUE="index.htm">Select a Page</OPTION>
<OPTION VALUE="crossword.htm">Crossword Puzzle</OPTION>
<OPTION VALUE="email.htm">E-mail Address Check</OPTION>
<OPTION VALUE="banner1.htm">Random Banner</OPTION>
<OPTION VALUE="quotes.htm">Random Quotes</OPTION>
<OPTION VALUE="rollover.htm">Rollover Example</OPTION>