Closed Thread Icon

Topic awaiting preservation: How to make it aline vertically??? (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=8690" title="Pages that link to Topic awaiting preservation: How to make it aline vertically??? (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: How to make it aline vertically??? <span class="small">(Page 1 of 1)</span>\

 
Hiroki
Paranoid (IV) Inmate

From: NZ
Insane since: Dec 2002

posted posted 06-05-2003 02:34

Hi, guys. How are you?
I am just about to be off for lunch.
But I want to ask this.
This morning, I worte a code to practice loop.
It is here.
As you can see, it looks not pretty.
I'd like to align vertically and nicelly.
I put a lot of   to separate each numbers. Probably this is silly idea.
I guess there will be good way to manag this kind of matter.
Would you have any idea to do so???


Hiroki Kozai

[This message has been edited by Hiroki (edited 06-05-2003).]

jstuartj
Bipolar (III) Inmate

From: Mpls, MN
Insane since: Dec 2000

posted posted 06-05-2003 03:02

One method is to simply write it into a table, you could then add table attributes or better yet use CSS to format.

Rember to use single quotes inside the double quotes of the document.write() method for the table attributes (ie. border='1' ).

code:
<html>

<head> </head>

<body>

<script type="text/javascript">

document.write("<table border='1'>");

document.write("<tr><td>Number</td><td>Square</td><td>Cube</td> </tr>");

for(i=1; i<=10; i++) {

document.write("<tr><td>" + (i) + "</td><td>" + (i * i) + "</td><td>" + (i* i * i) + "</td></tr>");

}

document.write("</table>");

</script>

</body>

</html>



J. Stuart J.


[This message has been edited by jstuartj (edited 06-05-2003).]

Hiroki
Paranoid (IV) Inmate

From: NZ
Insane since: Dec 2002

posted posted 06-05-2003 03:36

Hi, Mate!
Thanks a lot.
It is a beatiful day here NZ.
How about your place?
Cheers,

Hiroki Kozai

« BackwardsOnwards »

Show Forum Drop Down Menu