Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Oct 2007
    Location
    Michigan
    Posts
    36
    Thanks
    27
    Thanked 0 Times in 0 Posts

    need help with Array

    I have a gruop of Arrays that contain variable declarations about the daytona 500 winners. The script worked be fore I grouped the variable declarations in Arrays. per haps I have incorrevt syntax alomg the way please look at the script
    Code:
    <!--HIDE FROM INCOMPATABLE BROWSERS
    //STOP HIDING FROM INCOMPATABLE BROWSERS-->
    
    var drivers = new Array(6);
    drivers[0] = "Dale Jarret";
    drivers[1} = "Micheal Waltrip";
    drivers[2] = "Ward Burton";
    drivers[3] = "Micheal Waltrip";
    drivers[4] = "Dale Earnheart Jr";
    drivers[5] = "Jeff Gordon";
    
    
    var car = new Array(6);
    car[0] = "Ford";
    car[1] = "Chevy";
    car[2] = "Dodge";
    car[3] = "Chevy";
    car[4] = "Chevy";
    car[5] = "Chevy";
    
    
    
    var avgMPH = new Array(6);
    avgMPH2000[0] ="155.669";
    avgMPH2001[1] ="161.783";
    avgMPH2002[2] ="142.971";
    avgMPH2003[3] ="133.870";
    avgMPH2004[4] ="156.345";
    avgMPH2005[5] ="135.173";
    
    
    
    document.write("<p><strong>2000</strong>: " + drivers[0] + " won while driving a " + car[0] + " at an average speed of " + 
    avgMPH[0] +" miles per hour.</p> ");
    
    document.write("<p><strong>2001</strong>: " + drivers[1] + " won while driving a " + car[1] + " at an average speed of " + 
    avgMPH[1] + " miles per hour. </p> ");
    
    document.write("<p><strong>2002</strong>: " + drivers[2] + " won while driving a " + car[2] + " at an average speed of " + 
    avgMPH[2] + " miles per hour. </p> ");
    
    
    document.write("<p><strong>2003</strong>: " + drivers[3] + " won while driving a " + car[3] + " at an average speed of " +
    avgMPH[3] + " miles per hour. </p> ");
    
    
    document.write("<p><strong>2004</strong>: " + drivers[4] + " won while driving a " + car[4] + " at an average speed of " +
    avgMPH[4] + " miles per hour. </p> ");
    
    document.write("<p><strong>2005</strong>: " + drivers[5] + " won while driving a " + car[5] + " at an average speed of " +
    avgMPH[5] + " miles per hour. </p> ");

  • #2
    Regular Coder Rappa's Avatar
    Join Date
    Nov 2005
    Location
    LI
    Posts
    356
    Thanks
    21
    Thanked 9 Times in 9 Posts
    drivers[1} = "Micheal Waltrip";

    you put a curly brace in this one.


  •  

    Posting Permissions

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