91、鼠标周围的宣传文字

91、鼠标周围的宣传文字

脚本说明:

把如下代码加入<body>区域中

<script language="JavaScript">

<!--

var mouse=new Object()

mouse.msg="7stk.com欢迎你的光临"

mouse.x=0

mouse.y=0

mouse.speed=Math.PI/180  // 1 degree

mouse.radius=50

mouse.ms=new Array()

if(document.layers){

 document.captureEvents(Event.MOUSEMOVE)

 for(i=0;i<=mouse.msg.length;i++)document.write("<layer name='mousetext"+i+"'>"+mouse.msg.charAt(i)+"</layer>")

}else

 for(i=0;i<=mouse.msg.length;i++)document.write("<span id='mousetext"+i+"' class='tacoscript'>"+mouse.msg.charAt(i)+"</span>")

for(i=0;i<=mouse.msg.length;i++){

 mouse.ms[i]=document.getElementById?document.getElementById("mousetext"+i).style:document.all?document.all["mousetext"+i].style:document.layers["mousetext"+i]

 mouse.ms[i].deg=Math.PI*2/mouse.msg.length*i}

document.onmousemove=function m(e){

 if(!e)e=event

 mouse.x=document.all?document.body.scrollLeft+e.clientX:e.pageX

 mouse.y=document.all?document.body.scrollTop+e.clientY:e.pageY

 run()}

function run(){

 for(i=mouse.ms.length-1;i>=0;i--){

  mouse.ms[i].deg+=mouse.speed

  mouse.ms[i].left=mouse.x-Math.sin(mouse.ms[i].deg)*mouse.radius

  mouse.ms[i].top=mouse.y+Math.cos(mouse.ms[i].deg)*mouse.radius}}

setInterval(run,100)

//-->

</script>

<style type="text/css">

<!--

.tacoscript {font-size:10pt;POSITION: absolute;VISIBILITY: visible}

-->

</style>

 

Write a comment

Comments: 0