<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head><body bgcolor="#FFFFFF" text="#000000">
<script language="JavaScript1.2">
<!--
/*
Submitted by Marcin Wojtowicz [[email protected]
Featured on Website Abstraction (http://wsabstract.com)
For this and over 400+ free scripts, visit http://wsabstract.com
*/var trailLength = 8 // The length of trail (8 by default; put more for longer "tail")
var path = "cursor.gif" // URL of your image// do NOT modify anything beyond this point
var isIE = false,isNav = false,range = "all.",style = ".style",i,d = 0
var topPix = ".pixelTop",leftPix = ".pixelLeft",images,storage
if (document.layers) { // browser sniffer
isNav = true,range = "layers.",style = "",topPix = ".top",leftPix = ".left"
} else if (document.all) {
isIE = true
}
function initTrail() { // prepares the script
images = new Array() // prepare the image array
for (i = 0; i < parseInt(trailLength); i++) {
images[i] = new Image()
images[i].src = path
}
storage = new Array() // prepare the storage for the coordinates
for (i = 0; i < images.length*3; i++) {
storage[i] = 0
}
for (i = 0; i < images.length; i++) { // make divs for IE and layers for Navigator
(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() { // trailing function
for (i = 0; i < images.length; i++) { // for every div/layer
eval("document." + range + "obj" + i + style + topPix + "=" + storage[d]) // the Y-coordinate
eval("document." + range + "obj" + i + style + leftPix + "=" + storage[d+1]) // the X-coordinate
d = d+2
}
for (i = storage.length; i >= 2; i--) { // save the coordinate for the div/layer that's behind
storage[i] = storage[i-2]
}
d = 0 // reset for future use
var timer = setTimeout("trail()",10) // call recursively 
}
function processEvent(e) { // catches and processes the mousemove event 
if (isIE) { // for IE
storage[0] = window.event.y+document.body.scrollTop+10
storage[1] = window.event.x+document.body.scrollLeft+10
} else { // for Navigator
storage[0] = e.pageY+12
storage[1] = e.pageX+12
}
}
if (isNav) {
document.captureEvents(Event.MOUSEMOVE) // Defines what events to capture for Navigator
}
if (isIE || isNav) { // initiates the script
initTrail() 
document.onmousemove = processEvent // start capturing
}
//-->
</script>
</body>
</html>
试试 这个

解决方案 »

  1.   

    谢谢wwttyy(嘻嘻),你的效果很漂亮,我会给你加分的。
    但我想知道为什么出错,也想看看效果。 up
      

  2.   

    1,将''改为'
    2,在div中加入星星的字符,如*
    write('<div style="position:relative;width:1px;height:1px;background:#6699CC;font-size:1px;visibility:visible">*</div>') <script language=JavaScript> if (document.all){ with (document){ write('<div id="starsDiv" style="position:absolute;top:0px;left:0px">') write('<div style="position:relative;width:1px;height:1px;background:#6699CC;font-size:1px;visibility:visible">*</div>') write('<div style="position:relative;width:1px;height:1px;background:#6699CC;font-size:1px;visibility:visible"></div>') write('<div style="position:relative;width:1px;height:1px;background:#6699CC;font-size:1px;visibility:visible"></div>') write('<div style="position:relative;width:1px;height:1px;background:#6699CC;font-size:1px;visibility:visible"></div>') write('<div style="position:relative;width:1px;height:1px;background:#6699CC;font-size:1px;visibility:visible"></div>') write('<div style="position:relative;width:1px;height:1px;background:#6699CC;font-size:1px;visibility:visible"></div>') write('<div style="position:relative;width:1px;height:1px;background:#6699CC;font-size:1px;visibility:visible"></div>') write('<div style="position:relative;width:2px;height:2px;background:#6699CC;font-size:2px;visibility:visible"></div>') write('<div style="position:relative;width:2px;height:2px;background:#6699CC;font-size:2px;visibility:visible"></div>') write('<div style="position:relative;width:2px;height:2px;background:#6699CC;font-size:2px;visibility:visible"></div>') write('<div style="position:relative;width:2px;height:2px;background:#6699CC;font-size:2px;visibility:visible"></div>') write('<div style="position:relative;width:2px;height:2px;background:#6699CC;font-size:2px;visibility:visible"></div>') write('<div style="position:relative;width:2px;height:2px;background:#6699CC;font-size:2px;visibility:visible"></div>') write('<div style="position:relative;width:3px;height:3px;background:#6699CC;font-size:3px;visibility:visible"></div>') write('</div>') } } if (document.layers) {window.captureEvents(Event.MOUSEMOVE);} var yBase = 200; var xBase = 200; var step = 1; var currStep = 0; var Xpos = 1; var Ypos = 1; if (document.all) { function MoveHandler(){ Xpos = document.body.scrollLeft+event.x; Ypos = document.body.scrollTop+event.y; } document.onmousemove = MoveHandler; } else if (document.layers) { function xMoveHandler(evnt){ Xpos = evnt.pageX; Ypos = evnt.pageY; } window.onMouseMove = xMoveHandler; } function animateLogo() { if (document.all) { yBase = window.document.body.offsetHeight/6; xBase = window.document.body.offsetWidth/6; } else if (document.layers) { yBase = window.innerHeight/8; xBase = window.innerWidth/8; } if (document.all) { for ( i = 0 ; i < starsDiv.all.length ; i++ ) { starsDiv.all[i].style.top = Ypos + yBase*Math.sin((currStep + i*4)/12)*Math.cos(400+currStep/200); starsDiv.all[i].style.left = Xpos + xBase*Math.sin((currStep + i*3)/10)*Math.sin(currStep/200); } } else if (document.layers) { for ( j = 0 ; j < 14 ; j++ ) //number of NS layers! { var templayer="a"+j document.layers[templayer].top = Ypos + yBase*Math.sin((currStep + j*4)/12)*Math.cos(400+currStep/200); document.layers[templayer].left = Xpos + xBase*Math.sin((currStep + j*3)/10)*Math.sin(currStep/200); } } currStep+= step; setTimeout("animateLogo()", 10); } animateLogo(); </script>
      

  3.   

    是不是这样的效果啊!?write('<div style="position:relative;width:1px;height:1px;background:#6699CC;font-size:1px;visibility:visible">*</div>') <script language=JavaScript> if (document.all){ with (document){ write('<div id="starsDiv" style="position:absolute;top:0px;left:0px">') write('<div style="position:relative;width:1px;height:1px;background:#6699CC;font-size:1px;visibility:visible">*</div>') write('<div style="position:relative;width:1px;height:1px;background:#6699CC;font-size:1px;visibility:visible"></div>') write('<div style="position:relative;width:1px;height:1px;background:#6699CC;font-size:1px;visibility:visible"></div>') write('<div style="position:relative;width:1px;height:1px;background:#6699CC;font-size:1px;visibility:visible"></div>') write('<div style="position:relative;width:1px;height:1px;background:#6699CC;font-size:1px;visibility:visible"></div>') write('<div style="position:relative;width:1px;height:1px;background:#6699CC;font-size:1px;visibility:visible"></div>') write('<div style="position:relative;width:1px;height:1px;background:#6699CC;font-size:1px;visibility:visible"></div>') write('<div style="position:relative;width:2px;height:2px;background:#6699CC;font-size:2px;visibility:visible"></div>') write('<div style="position:relative;width:2px;height:2px;background:#6699CC;font-size:2px;visibility:visible"></div>') write('<div style="position:relative;width:2px;height:2px;background:#6699CC;font-size:2px;visibility:visible"></div>') write('<div style="position:relative;width:2px;height:2px;background:#6699CC;font-size:2px;visibility:visible"></div>') write('<div style="position:relative;width:2px;height:2px;background:#6699CC;font-size:2px;visibility:visible"></div>') write('<div style="position:relative;width:2px;height:2px;background:#6699CC;font-size:2px;visibility:visible"></div>') write('<div style="position:relative;width:3px;height:3px;background:#6699CC;font-size:3px;visibility:visible"></div>') write('</div>') } } if (document.layers) {window.captureEvents(Event.MOUSEMOVE);} var yBase = 200; var xBase = 200; var step = 1; var currStep = 0; var Xpos = 1; var Ypos = 1; if (document.all) { function MoveHandler(){ Xpos = document.body.scrollLeft+event.x; Ypos = document.body.scrollTop+event.y; } document.onmousemove = MoveHandler; } else if (document.layers) { function xMoveHandler(evnt){ Xpos = evnt.pageX; Ypos = evnt.pageY; } window.onMouseMove = xMoveHandler; } function animateLogo() { if (document.all) { yBase = window.document.body.offsetHeight/6; xBase = window.document.body.offsetWidth/6; } else if (document.layers) { yBase = window.innerHeight/8; xBase = window.innerWidth/8; } if (document.all) { for ( i = 0 ; i < starsDiv.all.length ; i++ ) { starsDiv.all[i].style.top = Ypos + yBase*Math.sin((currStep + i*4)/12)*Math.cos(400+currStep/200); starsDiv.all[i].style.left = Xpos + xBase*Math.sin((currStep + i*3)/10)*Math.sin(currStep/200); } } else if (document.layers) { for ( j = 0 ; j < 14 ; j++ ) //number of NS layers! { var templayer="a"+j document.layers[templayer].top = Ypos + yBase*Math.sin((currStep + j*4)/12)*Math.cos(400+currStep/200); document.layers[templayer].left = Xpos + xBase*Math.sin((currStep + j*3)/10)*Math.sin(currStep/200); } } currStep+= step; setTimeout("animateLogo()", 10); } animateLogo(); </script>
    自己输入页面就可以看了!  好运~~~~~~~~~~~
      

  4.   

    谢谢 seabell(百合心) 
    将''改为',就可以了。
    加不加*没影响!再次感谢!