2008年8月29日

鼠标轨迹

代码效果:鼠标轨迹。

代码如下:

<!--将以下代码加入HTML的<body></body>之间--> <br /><script language="JavaScript1.2">var trailLength = 8;var path = "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 < src =" path;}storage" i =" 0;" i =" 0;" 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" index="100"><img src="' + images[i].src + '" /></layer>');}trail();}function trail() {for (i = 0; i < d =" d+2;}for" i =" storage.length;">= 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) {document.captureEvents(Event.MOUSEMOVE);}if (isIE isNav) {initTrail();document.onmousemove = processEvent;}</script>


没有评论: