?<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>模擬下雪的背景特效</title></head><body>?<style>??? ?.drop{position:absolute; width:3; filter:flipV(),flipH(); font-size:40; color:blue}??? </style>??? <script type="text/javascript" language="javascript">??? ?snow=false;??snowsym="*";??rainsym="*";??howmany=15;//數(shù)量????if(snow){???sym=snowsym; speed=1; angle=10; drops=howmany??}??else{???sym=rainsym; speed=50; drops=howmany; angle=6??}??//設(shè)置x,y坐標(biāo)的移動方向和速度??movex=-speed/angle;??movey=speed;??count=0;????function moverain(){???for(move=0; move<drops; move++){????xx[move]+=movex; yy[move]+=mv[move];????hmm=Math.round(Math.random()*1);????if(xx[move]<0){?????xx[move]=maxx+10;//maxx?????}????if(yy[move]>maxy){?????yy[move]=10;????}????//更改表示雪花數(shù)組元素的左邊????drop[move].left=xx[move]//;有影響嗎?????drop[move].top=yy[move]+document.body.scrollTop;???}???setTimeout('moverain','1')//“”和‘’的區(qū)別??}?</script>??? <script type="text/javascript" language="javascript">??? ?if(document.all){???//生成存放雪花的數(shù)組drop,存放雪花位置的數(shù)組xx,yy,表示速度的數(shù)組mv???drop=new Array();???xx=new Array();???yy=new Array();???mv=new Array()//多出的;號。???ly="document.all[\'";st="\'].style"http://不懂?,分號???for(make=0; make<drops; make++){????//層表示雪花????document.write('<div id="drop'+make+'" class=drop>'+sym+'</div>');//語法信息????drop[make]=eval(ly+'drop'+make+st);????//設(shè)置雪花出現(xiàn)的最大位置????maxx=document.body.clientWidth-40;????maxx=document.body.clientWidth-40//多加了分號????//設(shè)置不同雪花出現(xiàn)的位置????xx[make]=Math.random()*maxx;????yy[make]=-100-Math.random()*manyy;????drrop[make].left=xx[make]????drop[make].top=yy[make]//又特么沒分號????//設(shè)置雪花的移動速度????mv[make]=(Math.random()*5)+speed/16;????//設(shè)置雪花的大小????drop[make].fontSize=(Math.random()*10)+20;????if(snow){?????col='white'????}????else{?????col='nlue'????}//又特么見單引號????drop[make].color=col;???}???window.onload=moverain??}??? </script></body></html>
完全沒雪花的效果
qq_季末先聲_03133538
2016-04-19 00:34:43