原始程式碼插入下面: <br/><!-- <br/>N = 40; <br/>Y = 新陣列(); <br/>X = new Array(); <br/>S = 新陣列( ); <br/>A = 新陣列(); <br/>B = 新陣列(); <br/>M = 新陣列(); <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("<圖層名稱='sn"+i+"' LEFT=0 TOP=0 BGCOLOR=' #FFFFF0' CLIP='0,0,"+M[i]+","+M[i]+"'>")} <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]+';高度:'+M[i]+';背景:#fffff0;字體大小:'+M[i]+'">')} <br/>document.write(' '); <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; layers)?window.pageYOffset:document.body.scrollTop; <br/>var L=(document.layers)?window.pageXOffset:document.body.scrollLeft; <br/>for (i=0; i < N; i++){ <br/> 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/>< /腳本> <br/>把<body>中的內容改為: <br/><body bgcolor=#ffffff onLoad="snow()"> <br/> 以上就是Javascript設計漫天雪花的內容,更多相關內容請關注PHP中文網( www.php.cn)! <p><p><br/>