Here`s my code.

<html>
<body>
<script type=text/javascript>
var n=0;


while(n<=10)
{

document.write("<center>"+n);
document.write("<br>")
n++;

}


</script>
</body>
</html>

The output is like this :
0
1
2
3
4
5
6
7
8
9
10
-- but they are in the center.

I want to put them in a table.
then put BG color in it.

Can you give me a hint on how to do that.
Thanks! :)

<html>
<body>
<script type=text/javascript>
var n=0;

document.write("<table border=1 width=100px>");
while(n<=10)
{

document.write("<tr><td align='center'>"+n);
document.write("</td></tr>")
n++;

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

</script>
</body>
</html>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.