原代码插入到下面: <br><!-- <br/>N = 40; <br/>Y = new Array(); <br/>X = new Array(); <br/>S = new Array(); <br/>A = new Array(); <br/>B = new Array(); <br/>M = new Array(); <br/>V = (document.layers)?1:0; iH=(document.layers)?window.innerHeight:window.document.body.clientHeight; <br/>iW=(document.layers)?window.innerWidth:window.document.body.clientWidth; <br/>for (i=0; i < N; i++){ <br/>Y[i]=Math.round(Math.random()*iH); <br/>X[i]=Math.round(Math.random()*iW); <br/>S[i]=Math.round(Math.random()*5+2); <br/>A[i]=0; <br/>B[i]=Math.random()*0.1+0.1; <br/>M[i]=Math.round(Math.random()*1+1); <br/>} <br/>if (V){ <br/>for (i = 0; i < N; i++) <br/>{document.write("<LAYER NAME='sn"+i+"' LEFT=0 TOP=0 BGCOLOR='#FFFFF0' CLIP='0,0,"+M[i]+","+M[i]+"'></LAYER>")} <br>} <br>else{ <br>document.write('<div style="position:absolute;top:0px;left:0px">'); <br>document.write('<div style="position:relative">'); <br>for (i = 0; i < N; i++) <br/>{document.write('<div id="si" style="position:absolute;top:0;left:0;width:'+M[i]+';height:'+M[i]+';background:#fffff0;font-size:'+M[i]+'"></div>')} <br>document.write('</div></div>'); <br>} <br>function snow(){ <br>var H=(document.layers)?window.innerHeight:window.document.body.clientHeight; <br>var W=(document.layers)?window.innerWidth:window.document.body.clientWidth; <br>var T=(document.layers)?window.pageYOffset:document.body.scrollTop; <br>var L=(document.layers)?window.pageXOffset:document.body.scrollLeft; <br>for (i=0; i < N; i++){ <br/>sy=S[i]*Math.sin(90*Math.PI/180); <br/>sx=S[i]*Math.cos(A[i]); <br/>Y[i]+=sy; <br/>X[i]+=sx; <br/>if (Y[i] > H){ <br>Y[i]=-10; <br>X[i]=Math.round(Math.random()*W); <br>M[i]=Math.round(Math.random()*1+1); <br>S[i]=Math.round(Math.random()*5+2); <br>} <br>if (V){document.layers['sn'+i].left=X[i];document.layers['sn'+i].top=Y[i]+T} <br>else{si[i].style.pixelLeft=X[i];si[i].style.pixelTop=Y[i]+T} <br>A[i]+=B[i]; <br>} <br>setTimeout('snow()',10); <br>} <br>//--> <br> 把中的内容改为: 以上就是Javascript设计漫天雪花的内容,更多相关内容请关注PHP中文网(m.sbmmt.com)!