語法說明:
- 在 Clrs=new Array('ff0000','00ff00','ffffff','ff00ff','ffa500','ffff00','00ff00','ffffff','ff00ff') 中修改滑鼠尾巴的色彩
- 在 amount=10; 中修改尾巴的大小
- 在 setTimeout("animateLogo()",50); 中修改尾巴跟隨的速度,數值越大就越慢,越小越快
<!--七彩尾巴_開始--> <script LANGUAGE="JavaScript"> <!-- <!--在此修改滑鼠尾巴的色彩--> Clrs=new Array('ff0000','00ff00','ffffff','ff00ff','ffa500','ffff00','00ff00','ffffff','ff00ff') <!--在此修改尾巴的大小--> amount=10; Xpos = 0; Ypos = 0; if (document.layers){ for (i = 0; i < amount; i++) {document.write('<layer name=nstrs'+i+' top=0 left=0 width='+i/2+' height='+i/2+' bgcolor=#ff0000></layer>')} window.captureEvents(Event.MOUSEMOVE); function nsMouse(evnt){ Xpos = evnt.pageX+1; Ypos = evnt.pageY+4 -window.pageYOffset; } window.onMouseMove = nsMouse; } else if (document.all){ document.write('<div id="Div" style="position:absolute;top:0px;left:0px">' +'<div style="position:relative">'); for (i = 0; i < amount; i++) {document.write('<div id="ieDiv" style="position:absolute;top:0px;left:0px;width:'+i/2+';height:'+i/2+';font-size:'+i/2+'"></div>')} document.write('</div></div>'); function ieMouse(){ Ypos = event.y+4; Xpos = event.x+1; } document.onmousemove = ieMouse; } function animateLogo(){ S=(document.layers)?window.pageYOffset:0; if (document.layers){ for (i = 0; i < amount; i++){ var randCol=Math.round(Math.random()*8); document.layers['nstrs'+i].bgColor=Clrs[randCol]; if (i < amount-1){ document.layers['nstrs'+i].top=document.layers['nstrs'+(i+1)].top; document.layers['nstrs'+i].left=document.layers['nstrs'+(i+1)].left; } else{ document.layers['nstrs'+i].top = Ypos+S; document.layers['nstrs'+i].left =Xpos; } } } else if (document.all){ Div.style.top=document.body.scrollTop; for (i = 0; i < amount; i++){ var randCol=Math.round(Math.random()*8); ieDiv[i].style.background=Clrs[randCol]; if (i < amount-1) { ieDiv[i].style.top=ieDiv[i+1].style.top; ieDiv[i].style.left=ieDiv[i+1].style.left; } else{ ieDiv[i].style.top = Ypos; ieDiv[i].style.left =Xpos; } } } <!--在此修改尾巴跟隨的速度--> setTimeout("animateLogo()",50); } animateLogo(); --> </script> <!--七彩尾巴_結束--> |
nicole 發表在 痞客邦 留言(0) 人氣()
留言列表