代幣如下: 复制代 代幣如下: ball.style.position = "絶対"; <BR>ball.style.color = "#FF0000"; <BR>ball.style.zIndex = 999999999; <BR>ball.innerHTML = "●"; <BR>document.body.appendChild(ball); <BR>} <br><br>ball.style["left"] = MouseX (Math.cos(angle)*radius) "px"; <BR>ball.style["top"] = MouseY (Math.sin(angle)*radius) "px"; <BR>角度 =0.1; <BR>} <BR>関数 MousePos(e) <BR>{ <BR>e = e ||ウィンドウ.イベント; <BR>var x,y; <BR>if(!document.all){ <BR>x = e.pageX; <BR>y = e.pageY; <BR>} <BR>else{ <BR>x =event.clientX document.documentElement.scrollLeft; <BR>y = イベント.clientY document.documentElement.scrollTop; <BR>} <BR>return {x:x,y:y}; <BR>} <BR>関数 setXY(e) <BR>{ <BR>e = e ||ウィンドウ.イベント; <BR>var pos = MousePos(e); <BR>mouseX = pos.x; <BR>mouseY = pos.y; <BR>} <BR>window.onload = function(){ <BR>setInterval(run,20); <br><br>document.documentElement.onmousemove = function(e){ <BR>e = e ||ウィンドウ.イベント; <BR>setXY(e); <BR>}; <BR>} <BR> 作成者: cnblogs airy