图片跟随鼠标移动问题
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.<html xmlns="http://www.
<head>
<title></title>
<script type="text/javascript">
document.onmousemove = function () {
var x = event.clientX;
var y = event.clientY;
var div1 = document.getElementById("div1");
if (!div1) {
return;
}
document.getElementById("xxx").value = x;
document.getElementById("yyy").value = y;
//image1.style.position = "absolute";
div1.style.top = y; //左上角的坐标
div1.style.left = x;
}
</script>
</head>
<body>
<div id="div1" >
<img alt="kaora" title="kaora" src="1.jpg" id="image1" /><br />
hello
</div>
<br />
<div>
<input type="text" id="xxx" /><br />
<input type="text" id="yyy" />
</div>
</body>
</html>
上面是源代码,我发现鼠标移动的时候,text标签里的值是跟着改变的,但是图片怎么也不动。。。求高手解释。。
[ 本帖最后由 zhuxuanzhu 于 2011-3-3 14:18 编辑 ]