...

View Full Version : need help with Array



Christech4000
12-15-2007, 10:43 PM
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

<!--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> ");

Rappa
12-16-2007, 12:03 AM
drivers[1} = "Micheal Waltrip";

you put a curly brace in this one.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum