SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot Da Mouse's Avatar
    Join Date
    Aug 2002
    Posts
    111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    JavaScript array problem

    <HTML>
    <HEAD>
    <TITLE>LANGUAGE</TITLE>

    <SCRIPT language="javascript">
    <!--hide from old grannies
    var volks = new array(3);
    volks[0] = "beatle";
    volks[1] = "sharan";
    volks[2] = "passat";
    alert(volks[0]);
    //let them put there glasses on -->
    </SCRIPT>

    </HEAD>
    <BODY>
    <FORM>
    <SELECT>

    <SCRIPT language="javascript">
    <!--hide from old grannies
    for(var x = 0; x <volks.length; x++)
    {
    document.writeln("<OPTION value='" + volks[loop] + "'>" + volks[loop] + "</OPTION>");
    }
    //let them put there glasses on -->
    </SCRIPT>

    </SELECT>
    </FORM>
    </BODY>
    </HTML>

    whats wrong with this?
    I am DaMouse
    Nobody can beat me so long as I'm stubborn -DaMouse
    Squeak

  2. #2
    SitePoint Addict
    Join Date
    May 2000
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    When you define your array you need to capitalize the "A" in array like this:
    var volks=new Array(3)

    also in your for loop change the variable "loop" to "x". Then it should work.

  3. #3
    SitePoint Zealot Da Mouse's Avatar
    Join Date
    Aug 2002
    Posts
    111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sorry about that the Array part was the only error I'd only half rewritten it when I posted sorry bout that

    THANKS anyhow
    I am DaMouse
    Nobody can beat me so long as I'm stubborn -DaMouse
    Squeak


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •