大雁南飞(请注意改变图片) - 中国WEB开发者网络 (http://www.webasp.net) -- 网页特效 (http://www.webasp.net/javascript/) --- 大雁南飞(请注意改变图片) (http://www.webasp.net/javascript/1/266.htm) |
| -- 发布日期: 2004-07-03 |
| <!-- 网页特效代码由[中国WEB开发者网络:http://www.ChinaWebDev.com]提供! --> <!-- 要实现此效果需要 2 个步骤: --> <!-- 第 1 步: --> <!-- 把<BODY>中的属性代码改为: --> <BODY bgcolor=#000000" onLoad="pRe();Animate()"> <!-- 第 2 步: --> <!-- 把下面的代码加到<BODY></BODY>区域中: --> <script language="JavaScript"> <!-- amount=7; function pRe(){ Img0=new Image(); Img0.src="0109bbat1.gif"; Img1=new Image(); Img1.src="0109bbat2.gif"; Img2=new Image(); Img2.src="0109bbat3.gif"; setTimeout('pRe()',3000) } brwsr=(document.layers)?1:0; if (brwsr){ window.captureEvents(Event.MOUSEMOVE); for (i=0; i < amount; i++) document.write("<LAYER NAME=n"+i+" LEFT=0 TOP=-50><IMG SRC='0109bbat1.gif' NAME='nsi'></LAYER>"); } else{ document.write('<div id="ie" style="position:absolute;top:0;left:0"><div style="position:relative">'); for (i=0; i < amount; i++) {document.write('<img name="msieBats" src="0109bbat1.gif" style="position:absolute;top:-50;left:0">')} document.write('</div></div>'); } bats=new Array('0109bbat1.gif','0109bbat2.gif','0109bbat3.gif','0109bbat2.gif') Xpos=0; Ypos=-50; yBase=0; xBase=0; step=0.5; currStep=0; a_count=0; b_count=1; c_count=2; move=1; if (brwsr){ function NsMouseFollow(evnt){ Xpos = evnt.pageX; Ypos = evnt.pageY; } window.onMouseMove = NsMouseFollow; } else{ function MsieMouseFollow(){ Xpos = event.x; Ypos = event.y; } document.onmousemove = MsieMouseFollow; } function Swirl(){ if (!brwsr)ie.style.top=document.body.scrollTop; yBase=(document.layers)?window.innerHeight/3:window.document.body.offsetHeight/3; xBase=(document.layers)?window.innerWidth/7:window.document.body.offsetWidth/7; for (i=0; i < amount; i++){ var layer=(document.layers)?document.layers["n"+i]:msieBats[i].style; layer.top = Ypos+yBase*Math.sin(((currStep)+i*3.7)/4)*Math.cos((currStep+i*35)/20) layer.left =Xpos+xBase*Math.cos(((currStep)+i*3.7)/4)*Math.cos((currStep+i*35)/62) } currStep+=step; } function Animate(){ if (a_count == bats.length) a_count=0; if (b_count == bats.length) b_count=0; if (c_count == bats.length) c_count=0; if (brwsr){ document.layers['n'+0].document.images['nsi'].src=bats[a_count]; document.layers['n'+1].document.images['nsi'].src=bats[b_count]; document.layers['n'+2].document.images['nsi'].src=bats[c_count]; } else{ msieBats[0].src=bats[a_count]; msieBats[1].src=bats[b_count]; msieBats[2].src=bats[c_count]; } if (amount > 2) { for (i=3; i < amount; i++) { if (brwsr) document.layers['n'+i].document.images['nsi'].src=bats[b_count]; else msieBats[i].src=bats[b_count]; } } a_count+=move; b_count+=move; c_count+=move; Swirl(); setTimeout('Animate()',30) } //--> </script> |
| webasp.net |