...

View Full Version : Problem with this script



Christech4000
12-24-2007, 07:49 PM
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>>>


<!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>>>


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

cyber11
12-25-2007, 12:33 PM
you are missing a + at td>" (leader1[2] * 2 + le



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum