2005/01/13 | 鼠标文字环绕代码
类别(网络技巧) | 评论(4) | 阅读(216) | 发表于 16:06
</SCRIPT>

<SCRIPT language=javascript>
<!-- Begin
document.write ('<style type="text/css">')
document.write ('<!--')
document.write ('.tacoscript {font-size:9pt; color=#6633FF; POSITION: absolute;VISIBILITY: visible}')
document.write ('-->')
document.write ('</style>')
var mouse=new Object()
mouse.msg="文字输入部分"
mouse.x=0
mouse.y=0
mouse.speed=Math.PI/58
mouse.radius=68 //******圆环半径*******//
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)
// End -->
</SCRIPT>

本站代码均来自本站对其它网站源码的的分析~供学习~效果见本站

0

评论Comments

日志分类
首页[227]
+随笔[68]
学习札记[67]
科研工具[44]
文献摘译[2]
程序语言[20]
网络技巧[26]
--[0]