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

    Problem with this script

    I have been working oin this and the problem is that I have done everything as I can see correctly but the js not working. please examine the code and see if you can find what it is. I used the FF error console and it pointed out the /td, td on line 24.

    The HTML>>>

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    
    
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
    <title>NBA Finals All-Time Scoring Leaders</title>
    <link rel="stylesheet" href="js_styles.css" type="text/css"/>
    <script src="nba.js" type="text/javascript"></script>
    
    </head>
    
    <body>
    
    <h1>NBA Finals</h1>
    
    <h2>ALL-Time Scoring Leader</h2>
    
    <script type="text/javascript">
    
    document.write("<table border = '1' width '100%'><colgroup span='1' width'30%' /><colgroup span ='5' width ='14%'/><tr><th>Player</th><th>games</th><th>2 pt.Baskets</th><th>Free Throws</th><th>Total Points</th><th>Avg</th></tr>");
    
    
    document.write("<tr><td>" + leader1[0] + "</td><td>" + leader1[1] + "</td><td>" + leader1[2] + "</td><td>" + leader1[3] + "</td><td>" + (leader1[2] * 2 + leader1[3] ) + "</td><td>" (leader1[2] * 2 + leader1[3]) / leader1[1] + "</td></tr>");
    
    
    document.write("<tr><td>" + leader1[0] + "</td><td>" + leader1[1] + "</td><td>" + leader1[2] + "</td><td>" + leader1[3] + "</td><td>" + (leader1[2] * 2 + leader1[3] ) + "</td><td>" (leader1[2] * 2 + leader1[3]) / leader1[1] + "</td></tr>");
    
    
    document.write("<tr><td>" + leader1[0] + "</td><td>" + leader1[1] + "</td><td>" + leader1[2] + "</td><td>" + leader1[3] + "</td><td>" + (leader1[2] * 2 + leader1[3] ) + "</td><td>" (leader1[2] * 2 + leader1[3]) / leader1[1] + "</td></tr>");
    
    	
    </script>
    </body>
    </html>


    The js>>>

    Code:
    var leader1 = new Array();
    leader1[0] = "Rick Barry";//player name
    leader1[1] = 10;//number of games
    leader1[2] = 138;//two point baskets
    leader1[3] = 87;//free throws
    
    
    
    var leader2 = new Array();
    leader2[0] = "Micheal Jordan";
    leader2[1] = 35;
    leader2[2] = 438;
    leader2[3] = 258;
    
    
    
    var leader3 = new Array();
    leader3[0] = "Shaquille \"Shaq\" O \'Neal";
    leader3[1] = "24";
    leader3[2] = "306";
    leader3[3] = "171";

  • #2
    New Coder
    Join Date
    Dec 2004
    Posts
    81
    Thanks
    0
    Thanked 0 Times in 0 Posts
    you are missing a + at td>" (leader1[2] * 2 + le


  •  

    Posting Permissions

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