专题文章
时长:00:00更新时间:2020-11-27 20:22:40
效果图。代码如下:<;,把鼠标的偏移量付给p document.onmousemove=function(ev){ //计算出鼠标在XY方向上移动的偏移量,把这个偏移量加给p的左边距和上边距,p就会跟着移动 var e=window.event|| ev;p.style.left=e.clientX-oX+";px";p.style.top=e.clientY-oY+";px";} //当鼠标按键抬起,把鼠标的偏移量付给p document.onmousemove=function(ev){ //计算出鼠标在XY方向上移动的偏移量,把这个偏移量加给p的左边距和上边距。
查看详情