why is the id="script" necessary?
What does the [CDATA[ mean? I haven't seen this before.
The id is probably not necessary. The cdata is in a comment (// = end of line comment).
6 variables were created or defined yet their elements were not specified. In all the tutorials I have seen online about arrays, they all showed that whenever an array is used their elements are also indicated. Where are the arrays' elements?
The following for loop adds to the arrays. If the value at i does not exist, then the index value is created.
Code:
for (var i=0; i<flakes; i++) {
flks[i]=createDiv(1, 1);
flkx[i]=3*Math.floor(Math.random()*swide/3);
flky[i]=Math.floor(Math.random()*shigh);
fldy[i]=2+Math.floor(Math.random()*4);
flks[i].style.left=flkx[i]+"px";
flks[i].style.top=flky[i]+"px";
b.appendChild(flks[i]);
}
var div=document.createElement("div");//Are they creating a div element?
Yes, but it does not add it to the page. You would have to use parent.appendChild() or something similar to add it the the page. In this case, the author does it by
Code:
flks[i]=createDiv(1, 1);
[ . . . ]
b.appendChild(flks[i]);
The code does not really do much because some of it is missing, such as the function let_it_snow().
Bookmarks