2008年8月29日

跟随鼠标的光环

代码效果:跟随鼠标的光环。

代码如下:


<!--将以下代码加入HTML的<Body></Body>之间--><br /><LAYER NAME="a0" LEFT="10" TOP="10" VISIBILITY="SHOW" BGCOLOR="#ffffff" CLIP="0,0,1,1"><br /></LAYER><br /><LAYER NAME="a1" LEFT="10" TOP="10" VISIBILITY="SHOW" BGCOLOR="#fff000" CLIP="0,0,1,1"><br /></LAYER><br /><LAYER NAME="a2" LEFT="10" TOP="10" VISIBILITY="SHOW" BGCOLOR="#ffa000" CLIP="0,0,1,1"><br /></LAYER><br /><LAYER NAME="a3" LEFT="10" TOP="10" VISIBILITY="SHOW" BGCOLOR="#ff00ff" CLIP="0,0,1,1"><br /></LAYER><br /><LAYER NAME="a4" LEFT="10" TOP="10" VISIBILITY="SHOW" BGCOLOR="#00ff00" CLIP="0,0,1,1"><br /></LAYER><br /><LAYER NAME="a5" LEFT="10" TOP="10" VISIBILITY="SHOW" BGCOLOR="#FF00FF" CLIP="0,0,1,1"><br /></LAYER><br /><LAYER NAME="a6" LEFT="10" TOP="10" VISIBILITY="SHOW" BGCOLOR="#FF0000" CLIP="0,0,1,1"><br /></LAYER><br /><LAYER NAME="a7" LEFT="10" TOP="10" VISIBILITY="SHOW" BGCOLOR="#ffffff" CLIP="0,0,2,2"><br /></LAYER><br /><LAYER NAME="a8" LEFT="10" TOP="10" VISIBILITY="SHOW" BGCOLOR="#fff000" CLIP="0,0,2,2"><br /></LAYER><br /><LAYER NAME="a9" LEFT="10" TOP="10" VISIBILITY="SHOW" BGCOLOR="#ffa000" CLIP="0,0,2,2"><br /></LAYER><br /><LAYER NAME="a10" LEFT="10" TOP="10" VISIBILITY="SHOW" BGCOLOR="#ff00ff" CLIP="0,0,2,2"><br /></LAYER><br /><LAYER NAME="a11" LEFT="10" TOP="10" VISIBILITY="SHOW" BGCOLOR="#00ff00" CLIP="0,0,2,2"><br /></LAYER><br /><LAYER NAME="a12" LEFT="10" TOP="10" VISIBILITY="SHOW" BGCOLOR="#0000ff" CLIP="0,0,2,2"><br /></LAYER><br /><LAYER NAME="a13" LEFT="10" TOP="10" VISIBILITY="SHOW" BGCOLOR="#FF0000" CLIP="0,0,2,2"><br /></LAYER><br /><script language="JavaScript"><br /><br />if (document.all){<br />with (document){<br />write('<div id="starsDiv" style="position:absolute;top:0px;left:0px">')<br />write('<div style="position:relative;width:1px;height:1px;background:#ffffff;font-size:1px;visibility:visible"></div>')<br />write('<div style="position:relative;width:1px;height:1px;background:#fff000;font-size:1px;visibility:visible"></div>')<br />write('<div style="position:relative;width:1px;height:1px;background:#ffa000;font-size:1px;visibility:visible"></div>')<br />write('<div style="position:relative;width:1px;height:1px;background:#ff00ff;font-size:1px;visibility:visible"></div>')<br />write('<div style="position:relative;width:1px;height:1px;background:#00ff00;font-size:1px;visibility:visible"></div>')<br />write('<div style="position:relative;width:1px;height:1px;background:#0000ff;font-size:1px;visibility:visible"></div>')<br />write('<div style="position:relative;width:1px;height:1px;background:#FF0000;font-size:1px;visibility:visible"></div>')<br />write('<div style="position:relative;width:2px;height:2px;background:#ffffff;font-size:2px;visibility:visible"></div>')<br />write('<div style="position:relative;width:2px;height:2px;background:#fff000;font-size:2px;visibility:visible"></div>')<br />write('<div style="position:relative;width:2px;height:2px;background:#ffa000;font-size:2px;visibility:visible"></div>')<br />write('<div style="position:relative;width:2px;height:2px;background:#ff00ff;font-size:2px;visibility:visible"></div>')<br />write('<div style="position:relative;width:2px;height:2px;background:#00ff00;font-size:2px;visibility:visible"></div>')<br />write('<div style="position:relative;width:2px;height:2px;background:#0000ff;font-size:2px;visibility:visible"></div>')<br />write('<div style="position:relative;width:3px;height:3px;background:#FF0000;font-size:3px;visibility:visible"></div>')<br />write('</div>')<br />}<br />}<br /><br />if (document.layers)<br />{window.captureEvents(Event.MOUSEMOVE);}<br />var yBase = 200;<br />var xBase = 200;<br />var step = 1;<br />var currStep = 0;<br />var Xpos = 1;<br />var Ypos = 1;<br />if (document.all)<br />{<br /> function MoveHandler(){<br /> Xpos = document.body.scrollLeft+event.x;<br /> Ypos = document.body.scrollTop+event.y;<br /> }<br /> document.onmousemove = MoveHandler;<br />}<br /><br />else if (document.layers)<br />{<br /> function xMoveHandler(evnt){<br /> Xpos = evnt.pageX;<br /> Ypos = evnt.pageY;<br /> }<br /> window.onMouseMove = xMoveHandler;<br />}<br /><br />function animateLogo() {<br />if (document.all)<br />{<br /> yBase = window.document.body.offsetHeight/6;<br /> xBase = window.document.body.offsetWidth/6;<br />}<br />else if (document.layers)<br />{<br /> yBase = window.innerHeight/8;<br /> xBase = window.innerWidth/8;<br />}<br /><br />if (document.all)<br />{<br /> for ( i = 0 ; i < starsDiv.all.length ; i++ )<br /> {<br /> starsDiv.all[i].style.top = Ypos + yBase*Math.sin((currStep + i*4)/12)*Math.cos(400+currStep/200);<br /> starsDiv.all[i].style.left = Xpos + xBase*Math.sin((currStep + i*3)/10)*Math.sin(currStep/200);<br /> }<br />}<br /><br />else if (document.layers)<br />{<br /> for ( j = 0 ; j < 14 ; j++ ) //number of NS layers!<br /> {<br /> var templayer="a"+j<br /> document.layers[templayer].top = Ypos + yBase*Math.sin((currStep + j*4)/12)*Math.cos(400+currStep/200);<br /> document.layers[templayer].left = Xpos + xBase*Math.sin((currStep + j*3)/10)*Math.sin(currStep/200);<br /> }<br />}<br />currStep+= step;<br />setTimeout("animateLogo()", 10);<br />}<br />animateLogo();<br /></script><br /><br />

没有评论: