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 3 of 3

Thread: looping & table

  1. #1
    New to the CF scene
    Join Date
    Oct 2003
    Location
    LA
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    looping & table

    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.

    <html>
    <head>
    <title> Tutorial 3 _ Question 4 </title>
    </head>
    <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");
    while(N<5)
    { col2 = 10*N, col3 = 100*N, col4 = 1000*N
    document.write("<tr><td>"+col2+"</td><td>"+col3+"</td><td>"+col4+"</td></tr>")
    N++
    }
    document.writeIn("</table>");
    }
    //-->
    </script>
    <body>
    </body>
    </html>

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Nashua, NH
    Posts
    1,724
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You got a VERY outdated tutorial....
    Vladdy | KL
    "Working web site is not the one that looks the same on common graphical browsers running on desktop computers, but the one that adequately delivers information regardless of device accessing it"

  • #3
    Regular Coder
    Join Date
    Apr 2003
    Location
    Atlanta, GA
    Posts
    487
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.


  •  

    Posting Permissions

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