|
Try adding var before your local variable declarations, so your function
becomes
function Navigate() {
var item = document.nav.search.selectedIndex;
itemval = document.nav.search.options[item].value;
if (itemval == "x") return;
window.location = "http://www." + itemval + ".com/";
}
In lugnet.off-topic.geek, Carl Watson writes:
> The simple script (below) I have written works fine in NN 4 & doesn't work
> in IE 5.
> Message - Line: 9, Char: 2, Error: Object doesn't support this action, Code:
> 0,
> Could someone please help me & let me know what I have done wrong or where I
> can get help.
>
> Thanks in advance for your help
>
> Carl
>
> ==================================
> <html>
> <head>
> <title>Drop down list</title>
> <script language="JavaScript">
> // define function
> function Navigate() {
> // determine which option was selected
> item = document.nav.search.selectedIndex;
> // recieve value from selected option
> itemval = document.nav.search.options[item].value;
> // check that selection was valid
> if (itemval == "x") return;
> // use value from selected option to go to new page
> window.location = "http://www." + itemval + ".com/";
> }
> </script>
> </head>
> <body>
> <form name="nav">
> <select name="search" onChange="Navigate()">
> <option value="x" selected>Search Engines</option>
> <option value="x">---------------</option>
> <option value="google">Google</option>
> <option value="alltheweb">All The Web</option>
> <option value="yahoo">Yahoo</option>
> <option value="lycos">Lycos</option>
> <option value="hotbot">HotBot</option>
> <option value="dogpile">Dogpile</option>
> <option value="altavista">AltaVista</option>
> <option value="metacrawler">MetaCrawler</option>
> <option value="looksmart">LookSmart</option>
> <option value="ask">Ask Jeeves</option>
> </select>
> </form>
> </body>
> </html>
> ==================================
|
|
Message is in Reply To:
2 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|