·返回首页
·联系我们
·在线留言
搜索内容 : 搜索类别 :
 
   页面游动吐泡小鱼

以下是代码片段:
<html>

 

<body onLoad="Start()">
<script language="JavaScript">
<!--
Image0=new Image();
Image0.src="http://www.jscode.cn/Uploadfile/2006515152552219.GIF";
Amount=12;
Pics=new Array();
Load=new Array();
Ypos=new Array();
Xpos=new Array();
Speed=new Array();
Rate=new Array();
Grow=new Array();
Step=new Array();
Cstep=new Array();
NsSize=new Array();
Ns=(document.layers)?1:0;
Pos=-1;
Jog=1;
Timer=null;
for(i=0; i <= 6; i++)
function PreLoad(){
for(i=0; i < Pics.length; i++){
 Load[i]=new Image();
 Load[i].src=Pics[i];
 }
}
PreLoad();
Strt=0-(Load[0].width+50);
function AniFish(){
Pos+=Jog;
if (Pos >= Pics.length) Pos=0;
if (Ns) document.nfish.document.images.nframe.src=Pics[Pos];
else document.images.iframe.src=Pics[Pos];
Timer=setTimeout('AniFish()',50)
}
function MoveFish(){
H=(document.layers)?window.innerHeight+window.pageYOffset:window.document.body.clientHeight+document.body.scrollTop;
W=(document.layers)?window.innerWidth+window.pageXOffset:window.document.body.clientWidth+document.body.scrollLeft;
Strt-=2;
if (Strt < 0-(Load[0].width)) Strt=W;
if (Ns)
else
setTimeout('MoveFish()',10)
}
H2=(document.layers)?window.innerHeight:window.document.body.clientHeight;
 for (i=0; i < Amount; i++)
if (Ns){
for (i = 0; i < Amount; i++){
document.write("<layer name='sn"+i+"' left=0 top=-50><img src="+Image0.src+" name='N' width="+NsSize[i]+" height="+NsSize[i]+"></layer>");
}
document.write("<layer name='nfish' left=0 top=-50><img src='0.gif' name='nframe'></layer>");
}
else{
document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');
for (i = 0; i < Amount; i++){
document.write('<img id="si" src="'+Image0.src+'" style="position:absolute;top:-100px;left:0px;filter:alpha(opacity=90)">');
}
document.write('</div></div>');
document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">'
+'<img id="ifish" src="0.gif" name="iframe" style="position:absolute;top:-100px;left:0px"></div></div>');
}
function Bubbles(){
Hs=(document.layers)?window.pageYOffset:document.body.scrollTop;
Ws=(document.layers)?window.pageXOffset:document.body.scrollLeft;
for (i=0; i < Amount; i++){
sy = Speed[i]*Math.sin(270*Math.PI/180);
sx = Speed[i]*Math.cos(Cstep[i]*5);
Ypos[i]+=sy;
Xpos[i]+=sx;
if (Ypos[i] < -40){
if (Ns)
else
Speed[i]= 6+Math.random()*3;
Grow[i]=4;
NsSize[i]=Math.random()*4+6;
}
if (Ns)
else
Grow[i]+=Rate[i];
Cstep[i]+=Step[i];
if (Grow[i] > 15) Grow[i]=16;
}
setTimeout('Bubbles()',10);
}
function Start()
//-->
</script>
</body>

</html>

                    检测代码效果 请进


 

               

 版权所有:网站通建站专家网  请勿翻版转载

 地址:中国·江西·宜春市官山路75号

 在线咨询:      

 咨询电话:15507950000  投诉建议:13177777713   邮箱:wangzhant@qq.com

 《中华人民共和国信息产业部ICP网站备案》  IPC备案号:赣ICP备08003251号

网站管理