✔ 最佳答案
以下係落雪既Java Script
放係<head>與</head>之間
<style type="text/css& quot;>
.snow {position:absolute; layer-background-col or:lightblue; visibility:visible; top:-50px; width:50px; height:50px; font-size:1px; background-color:lig htblue}
</style>
放係<body>與</body>之間
<SCRIPT Language="JavaS cript">
var drops=75; //NUMBER OF OBJECTS YOU WANT.
var level=1; //SPEED LEVEL 1 to 5. 1=SLOWER, 5=FASTER
var isNS=(document.layer s);
var _all= (isNS)? '' : 'all.' ;
var _style= (isNS) ? '' : '.style' ;
var w_x, w_y, id=0;
for(i=1;i<=drops; i++){
document.writeln( 9;<div id="drop'+i +'" class="snow&quo t;></div>&# 39;);
eval('var drop'+i+'=do cument.'+_all+&# 39;drop'+i+_styl e);
}
function init(){
level=Math.max(Math. min(5,level),1)
findwindowparams();
for(i=1;i<=drops; i++){
getstartpos(eval( 9;drop'+i));
(isNS)? eval('drop'+ i+'.top='+Ma th.floor(Math.random ()*(w_y-10))) : eval('drop'+ i+'.top='+Ma th.floor(Math.random ()*(w_y-10))) ;
}
setInterval('mov edrop()',50);
}
function getstartpos(obj){
obj.size=Math.floor( Math.random()*5)+1
obj.ystep=obj.size*l evel;
obj.xstep=obj.ystep/ 5;
if(isNS){
obj.clip.width=obj.c lip.height=obj.size;
obj.left=obj.xpos=Ma th.floor(Math.random ()*w_x)-obj.size;
obj.top=0;
}else{
obj.width=obj.height =obj.size;
obj.pixelTop=0;
obj.pixelLeft=obj.xp os=Math.floor(Math.r andom()*w_x)-obj.siz e;
}}
function movedrop(dropN){
for(i=1;i<=drops; i++){
dropN=eval('drop '+i);
dropN.xpos-=dropN.xs tep;
if(isNS){
if( (dropN.top+dropN.yst ep+dropN.size>=w_ y+pageYOffset) || (dropN.xpos-dropN.si ze<pageXOffset)){
getstartpos(dropN);
}else{
dropN.top+=dropN.yst ep;
dropN.left=dropN.xpo s;
}}else{
if( (dropN.pixelTop+drop N.ystep+dropN.size&g t;=w_y+document.body .scrollTop) || (dropN.xpos-dropN.si ze<document.body. scrollLeft) || (dropN.pixelLeft> w_x-dropN.size)){
getstartpos(dropN);
}else{
dropN.pixelTop+=drop N.ystep;
dropN.pixelLeft=drop N.xpos;
}}}}
function findwindowparams(){
w_x=(isNS)? window.innerWidth : document.body.client Width;
w_y=(isNS)? window.innerHeight : document.body.client Height;
}
function reloadNS(){
setTimeout('wind ow.location.reload() ', 500);
}
(isNS)? window.onresize=relo adNS : window.onresize=find windowparams;
window.onload=init;
</SCRIPT>
PS. 可以將以下橙色既地方改為自己鐘意既~
.snow {position:absolute; layer-background-col or:lightblue; visibility:visible; top:-50px; width:50px; height:50px; font-size:1px; background-color:lightblue}
var drops=75; //NUMBER OF OBJECTS YOU WANT.
var level=1; //SPEED LEVEL 1 to 5. 1=SLOWER, 5=FASTER