View Full Version : looping & table

10-08-2003, 05:52 PM
My script got some problems. I want to to a table like this :

N 10*N 100*N 1000*N
1 10 100 1000
2 20 200 2000
3 30 300 3000
4 40 400 4000
5 50 500 5000

And it is with border.
Please tell me what wrong it is.

<title> Tutorial 3 _ Question 4 </title>
<SCRIPT language=javascript type=text/javascript>
<!-- Hide javascript from older browsers
N = 1
document.write("<table border = 1>\n" + "<tr><th>N<th>10*N<th>100*N<th>1000*N");
{ col2 = 10*N, col3 = 100*N, col4 = 1000*N

10-08-2003, 06:15 PM
You got a VERY outdated tutorial....

10-08-2003, 07:55 PM
That may be the case Vladdy, but should we not try to help poor shmily?

The most glaring error I see with your script as it stands is that you're calling on document.writeIn(), which doesn't exist. Try subsituting in a lowercase L for that capital i, so that it becomes document.writeln().

To more properly address Vladdy's concern, you may wish to dump this script altogether and create elements by using the DOM. However, I would wager that you're fairly new to scripting, so go ahead and get the syntax (language) down, and then worry about the APIs (objects, properties, and methods which exist).

Best of luck to you.