To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.off-topic.geekOpen lugnet.off-topic.geek in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Off-Topic / Geek / 3524
3523  |  3525
Subject: 
some assistance with javascript please.
Newsgroups: 
lugnet.off-topic.geek, lugnet.publish.html
Date: 
Tue, 15 Jan 2002 05:28:44 GMT
Viewed: 
1799 times
  
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 has 1 Reply:
  Re: some assistance with javascript please.
 
Try adding var before your local variable declarations, so your function becomes function Navigate() { var item = document.nav.search....ctedIndex; itemval = document.nav.search....em].value; if (itemval == "x") return; window.location = "(URL) + (...) (23 years ago, 15-Jan-02, to lugnet.off-topic.geek, lugnet.publish.html)

2 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR