图片随着鼠标移动而移动的效果
<script?type="text/javascript">
document.onmousemove=function(){
var?x?=?window.event.clientX;//clientX表示鼠标在X轴上的移动坐标
var?y?=?window.event.clientY;
????var?divFly?=?document.getElementById("divFly");
if(!divFly){
????return?;
}
divFly.style.left?=?x;
divFly.style.top?=?y;
}
</script>
<div?id="divFly"?style="position:?absolute;">
? ????<img??src="5.jpg"><br>
</div>
<!--EndFragment-->