这个htm文件直接打开有鼠标跟随的效果,但是如果用虚拟路径执行就没有效果
<html>
<head>
<title> 跟随鼠标的图片 </title>
</head>
<body>
<div id=cursor style= "height: 25px; left: 100px; position: absolute; top: 160px; visibility: visible; width: 100px; z-index: 1; ">
<IMG SRC= "02.gif "> </DIV>
<SCRIPT language=JavaScript>
<!--
function YY_Mousetrace(evnt) {
if (yyns4)
{if (evnt.pageX) {yy_ml=evnt.pageX; yy_mt=evnt.pageY;} }
else{
yy_ml=(event.clientX + document.body.scrollLeft);
yy_mt=(event.clientY + document.body.scrollTop);
}
if (yy_tracescript)eval(yy_tracescript)
}
function m()
{
document.all.cursor.style.left=yy_ml+10
document.all.cursor.style.top=yy_mt+10
}
//-->
</SCRIPT>
<SCRIPT language=JavaScript>
<!--
var yyns4=window.Event?true:false; var yy_mt = 0; var yy_ml = 0;
if (yyns4) document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = YY_Mousetrace;
yy_tracescript = 'm() ';
//-->
</SCRIPT>
</body>
</html>
------解决方案-------------------- <IMG SRC= "02.gif ">
==============〉换成绝对路径看看