O
onehp
Guest
This script will make a christmas tree but I want it to write it in the div named content instead in the body.
<div id="content">
</div>
Code:
<script>
var width = 1;
for(height=0; height<=5; height++)
{
for(subHeight=0; subHeight<=5; subHeight++)
{
for(subWidth=1; subWidth<=width; subWidth++)
{
var Ornament=Math.round(Math.random()*10)+1;
var oColor=Math.floor(Math.random()*16000000)+1;
if (Ornament<=1)
{
document.write("<font color="+oColor+">1</font>");
}
if (Ornament>=2)
{
document.write("<font color="+oColor+">0</font>");
}
}
document.write("<br>")
width = width + 1;
}
width=width - 2;//thickness
}
</script>
<div id="content">
</div>