close
語法說明:
1.在 msg='歡迎光臨小林工作室'; 中修改顯示區域的寬度
2.在 msgSize=5; 中修改文字的大小(字體大小為1~7)
3.在 FoNt='Tahoma,Georgia'; 中修改文字的字型
4.在 CoLoR='FF0000'; 中修改文字的顏色
5.在 speed=2; 中修改文字跑動的速度,越直越大就越快,越小越慢
<!--文字集結_開始--> <script language="JavaScript"> <!-- <!--在此修改要顯示的文字--> msg='歡迎光臨小林工作室'; <!--在此修改文字的大小(字體大小為1~7)--> msgSize=5; <!--在此修改文字的字型--> FoNt='Tahoma,Georgia'; <!--在此修改文字的顏色--> CoLoR='FF0000'; <!--在此修改文字跑動的速度--> speed=2; ns=(document.layers)?1:0; msg=msg.split(''),amount=msg.length,Y=0,X=0,ypos=0,xpos=0,ybase=new Array(),xbase=new Array(); angle = new Array(),divTop= new Array(),divLeft=new Array(); DocHeight=(document.layers)?window.innerHeight:window.document.body.offsetHeight; DocWidth=(document.layers)?window.innerWidth:window.document.body.offsetWidth; for (i=0; i < amount; i++){ divTop[i]=Math.round(Math.random()*DocHeight); divLeft[i]=Math.round(Math.random()*DocWidth); } if (ns){ for (i = 0; i < amount; i++) {document.write('<layer name=nsd'+i+' top=0 left=0 width='+msgSize+' height='+msgSize+'><font face='+FoNt+' size='+msgSize+' color='+CoLoR+'>'+msg[i]+'</font></layer>');} window.captureEvents(Event.MOUSEMOVE); function nsMouse(evnt){ ypos = evnt.pageY-20; xpos = evnt.pageX-10; } window.onMouseMove = nsMouse; } else{ document.write('<div id="hldr" style="position:absolute;top:0px;left:0px">') document.write('<div style="position:relative">') for (i=0; i < amount; i++) {document.write('<div id=ied style="position:absolute;top:0px;left:0px;width:'+msgSize+';height:'+msgSize+'"><font face='+FoNt+' size='+msgSize+' color='+CoLoR+'>'+msg[i]+'</font></div>')} document.write('</div></div>') function ieMouse(){ ypos = event.y-20; xpos = event.x-10; } document.onmousemove = ieMouse; } function GoToMouse(){ var DocHeight=(document.layers)?window.innerHeight:window.document.body.offsetHeight; var DocWidth=(document.layers)?window.innerWidth:window.document.body.offsetWidth; var iscrll=(document.all)?document.body.scrollTop:0; var nscrll=(document.layers)?window.pageYOffset:0; if (!ns)hldr.style.top=iscrll; for (i=0; i < amount; i++){ Y = ypos - divTop[i]; X = xpos - divLeft[i]; angle[i] = Math.round(Math.atan2(Y,X) * 180/Math.PI); if (angle[i] < 0) angle[i] += 360; ybase[i]=Math.round(Math.random()*DocHeight); xbase[i]=Math.round(Math.random()*DocWidth); rep=Math.round(Math.random() * 3); extra=Math.round(Math.random() * 200) if (rep == 3)xbase[i] =-extra; if (rep == 2)xbase[i] =DocWidth+extra; if (rep == 1)ybase[i] =-extra; if (rep == 0)ybase[i] =DocHeight; y = Math.round(speed*Math.sin(angle[i]*Math.PI/180)); x = Math.round(speed*Math.cos(angle[i]*Math.PI/180)); divTop[i]+=y; divLeft[i]+=x; if ((divLeft[i] > xpos-speed) && (divLeft[i] < xpos+speed/1.5) && (divTop[i] >= ypos-speed/1.5) && (divTop[i] <= ypos+speed/1.5)) {divTop[i]=ybase[i]+nscrll;divLeft[i]=xbase[i]} var layer=(document.layers)?document.layers['nsd'+i]:ied[i].style; layer.top=divTop[i];layer.left=divLeft[i]; } S=setTimeout('GoToMouse()',10); } window.onload=GoToMouse; --> </script> <!--文字集結_結束--> |
全站熱搜
留言列表