迈克勒姆打球特点:博客技巧

来源:百度文库 编辑:神马品牌网 时间:2024/04/28 08:54:59
我想让我的新浪博客首页一打开就有雪花从顶部落下的效果,要怎么弄,代码和具体的步骤.谢谢.

我没弄过
不过我这有特效的代码
<html>

<body bgcolor=black>

<script language="JavaScript">
<!--
//雪花的数目
N =20;
//雪花的纵坐标
Y = new Array();
//雪花的横坐标
X = new Array();
S = new Array();
A = new Array();
//雪花飘落轨迹的参数
B = new Array();
//雪花的大小参数
M = new Array();
//判断浏览器类型使在IE或NETSCAP都可用。
V = (document.layers)?1:0;

iH=(document.layers)?window.innerHeight:window.document.body.clientHeight;
iW=(document.layers)?window.innerWidth:window.document.body.clientWidth;

//各项参数的随机初始化
for (i=0; i < N; i++){
Y[i]=Math.round(Math.random()*iH);
X[i]=Math.round(Math.random()*iW);
S[i]=Math.round(Math.random()*5+2);
A[i]=0;
B[i]=Math.random()*0.1+0.1;
M[i]=Math.round(Math.random()*1+7);
}
if (V){
//利用css,建立雪花层,其中雪花是利用Wingdings字体来实现
for (i = 0; i < N; i++)
{document.write("<LAYER NAME='sn"+i+"' LEFT=0 TOP=0 BGCOLOR='#FFFFF0' CLIP='0,0,"+M[i]+","+M[i]+"';z-index: 1><font color=white size=3 face='Wingdings'>T</font></LAYER>")}
}
else{
document.write('<div style="position:absolute;top:0px;left:0px;z-index: 1">');
document.write('<div style="position:relative;z-index: 1">');
for (i = 0; i < N; i++)
{document.write('<div id="si" style="position:absolute;z-index: 1;top:0;left:0;width:'+M[i]+';height:'+M[i]+';background:#000000;font-size:'+M[i]+'"><font color=white size=3 face="Wingdings">T</font></div>')}
document.write('</div></div>');
}
//以下是雪花飘动的程序代码
function snow(){
//获得浏览器窗口的大小及位置信息
var H=(document.layers)?window.innerHeight:window.document.body.clientHeight;
var W=(document.layers)?window.innerWidth:window.document.body.clientWidth;
var T=(document.layers)?window.pageYOffset:document.body.scrollTop;
var L=(document.layers)?window.pageXOffset:document.body.scrollLeft;
//雪花飘动的轨迹函数
for (i=0; i < N; i++){
sy=S[i];
sx=S[i]*Math.cos(A[i]);
Y[i]+=sy;
X[i]+=sx;
//判断雪花是否落到了窗口以下
if (Y[i] > H){
Y[i]=-10;
X[i]=Math.round(Math.random()*W);
M[i]=Math.round(Math.random()*1+7);
S[i]=Math.round(Math.random()*5+2);
}
//移动雪花层
if (V){document.layers['sn'+i].left=X[i];document.layers['sn'+i].top=Y[i]+T}
else{si[i].style.pixelLeft=X[i];si[i].style.pixelTop=Y[i]+T}
A[i]+=B[i];
}
//每个40/1000秒重画雪花层,达到动态效果
setTimeout('snow()',40);
}
snow()
//-->
</script>

</body>
</html>

9494! *(^_^)*