<!DOCTYPE html PBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtmll/DTD/xhtmll-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>鼠标跟随字体</title>
<style type="text/css">
.spanstyle {color: #990; font-family: 宋体; font-size: 10pt; position: absolute;
top: -50px; visibility: visible;}
</style>
</head>
<body>
<script>
var x,y
var step=12;
var flag=0;
var message="鼠标跟随字体HTML网站设计JavaScript小程序"
message=message.split("")
var xpos=new Array()
for (i=0;i<=message.length-1;i++){
xpos[i]=-50
}
var ypos=new Array()
for (i=0;i<=message.length-1;i++){
ypos[i]=-200
}
function handlerMM(e){
x=(document.layers) ? e.pageX:document.body.scrollLeft+event.clientX
y=(document.layers) ? e.pageY:document.body.scrollTop+event.clientY
flag=1
}
function www_helpor_net(){
if(flag==1 && document.all){
for(i=message.length-1;i>=1;i--){
xpos[i]=xpos[i-1]+step
ypos[i]=ypos[i-1]
}
xpos[0]=x+step
ypos[0]=y
for(i=0;i<message.length-1;i++){
var thisspan=eval("span"+(i)+".style")
thisspan.posLeft=xpos[i]
thisspan.posTop=ypos[i]
}
}
else if(flag==1 && document.layers){
for(i-message.length-1;i++){
xpos[i]=xpos[i-1]+step
ypos[i]=ypos[i-1]
}
xpos[0]=x+step
ypos[0]=y
for(i=0;i<message.length-1;i++){
thisspan.left=xpos[i]
thisspan.top=ypos[i]
}
}
var timer=setTimeout("www_helpor_net()",30)
}
for(i=0;i<=message.length-1;i++){
document.write("<span id='span"+i+"' class='spanstyle'>")
document.write(message[i])
document.write("</span>")
}
if (document.layers){
document.captureEvents(Event.MOUSEMOVE);
}
document.onmousemove=handlerMM;
www_halpor_net();
//-->
</script>
</body>
</html>