This script makes a random sized Christmas tree with random lights.
- Copy the coding into the HEAD of your HTML document
- Add the last code into the BODY of your HTML document
<!– STEP ONE: Paste this code into the HEAD of your HTML document –>
<HEAD>
<!– This script and many more are available free online at –>
<!– The JavaScript Source!! http://javascriptsource.com –>
<!– Original: Bryan Hood ([email protected]) –>
<!– Web Site: http://www.bnhrobotics.com –>
<STYLE>
BLOCKQUOTE {font-weight:900; line-height:0.75em}
</STYLE>
</HEAD>
<!– STEP TWO: Copy this code into the BODY of your HTML document –>
<BODY>
<!– This script and many more are available free online at –>
<!– The JavaScript Source!! http://javascriptsource.com –>
<!– Original: Bryan Hood ([email protected]) –>
<!– Web Site: http://www.bnhrobotics.com –>
<BLOCKQUOTE><FONT COLOR=#fafafa><CENTER>
*<BR>
* * *<BR>
* *<BR>
<FONT COLOR=GREEN>
<SCRIPT LANGUAGE=”JavaScript”>
<!–
var Number=Math.random()*10+3;
var Length=Math.round(Number)
var width=1;
for (i=0; i<=Length; i++)
{
for (x=0; x<=4; x++)
{
for (y=1; y<=width; y++)
{
var NewNumber=Math.random()*15;
var Ornament=Math.round(NewNumber);
if (Ornament<=1)
{
document.write(“</FONT><FONT COLOR=RED> ^</FONT><FONT COLOR=GREEN>”);
}
if (Ornament>=2){
document.write(” ^”);
}
}
document.write(“<BR>”);
var width=width+1;
}
var width=width-2;
}
//–>
</SCRIPT>
</CENTER></FONT></BLOCKQUOTE>
<p><center>
<font face=”arial, helvetica” size”-2″>Free JavaScripts provided<br>
by <a href=”https://javascriptsource.com”>The JavaScript Source</a></font>
</center><p>