·返回首页
·联系我们
·在线留言
搜索内容 : 搜索类别 :
 
   鼠标轨迹,原理很简单

以下是引用片段:


<html>
<head>
<title>网页特效|Linkweb.cn/Js|---鼠标轨迹,原理很简单</title>
</head><BODY>图像文件:<img src="images/cursor1.gif" width="11" height="19"><BR>请将此文件与网页文件保存在同目录下<BR>
<BR>
<!--将以下代码加入HTML的<Body></Body>之间-->

<SCRIPT language=JavaScript1.2>
var trailLength = 8;
var path = "images/cursor1.gif";
var isIE = false, isNav = false, range = "all.", style = ".style", i, d = 0;
var topPix = ".pixelTop", leftPix = ".pixelLeft", images, storage;
if (document.layers) {
isNav = true, range = "layers.", style = "", topPix = ".top", leftPix = ".left";
} else if (document.all) {
isIE = true;
}
function initTrail() {
images = new Array();
for (i = 0; i < parseInt(trailLength); i++) {
images[i] = new Image();
images[i].src = path;
}
storage = new Array();
for (i = 0; i < images.length*3; i++) {
storage[i] = 0;
}
for (i = 0; i < images.length; i++) {
(isIE) ? document.write('<div id="obj' + i + '" style="position: absolute; z-Index: 100; height: 0; width: 0"><img src="' + images[i].src + '"></div>') : document.write('<layer name="obj' + i + '" width="0" height="0" z-index="100"><img src="' + images[i].src + '"></layer>');
}
trail();
}
function trail() {
for (i = 0; i < images.length; i++) {
eval("document." + range + "obj" + i + style + topPix + "=" + storage[d]);
eval("document." + range + "obj" + i + style + leftPix + "=" + storage[d+1]);
d = d+2;
}
for (i = storage.length; i >= 2; i--) {;
storage[i] = storage[i-2];
}
d = 0;
clearTimeout(timer);
var timer = setTimeout("trail()", 10);
}
function processEvent(e) {
if (isIE) {
storage[0] = window.event.y+document.body.scrollTop+10;
storage[1] = window.event.x+document.body.scrollLeft+10;
} else {
storage[0] = e.pageY+12;
storage[1] = e.pageX+12;
   }
}
if (isNav)
if (isIE || isNav) {
initTrail();
document.onmousemove = processEvent;
}
</SCRIPT>
</body></html>

                                   检测代码效果 请进

 

          

 版权所有:网站通建站专家网  请勿翻版转载

 地址:中国·江西·宜春市官山路75号

 在线咨询:      

 咨询电话:15507950000  投诉建议:13177777713   邮箱:wangzhant@qq.com

 《中华人民共和国信息产业部ICP网站备案》  IPC备案号:赣ICP备08003251号

网站管理