为什么title的值是160,117而不是150,105
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<style type="text/css">
*{
margin: 0 0;
padding: 0 0;
}
div{
width: 400px;
height: 250px;
background: black;
/*margin: 0 auto;*/
text-align: center;
line-height: 250px;
position: absolute;
left: 0;
top: 0;
}
span{
width: 100px;
height: 40px;
background: white;
color: black;
}
</style>
<title></title>
</head>
<body>
<div id="div1">
<span id="span1">按住我拖拽</span>
</div>
<script type="text/javascript">
var fubiaoqian=document.getElementById("div1")
var benshen=document.getElementById("span1")
benshen.style.cursor="pointer"
function tuodong(){
document.onmousemove=function(weizhi){
var weizhi=weizhi||window.weizhi;
var juliX=benshen.offsetLeft
juliY=benshen.offsetTop
fubiaoqian.style.left=weizhi.clientX+"px"
fubiaoqian.style.top=weizhi.clientY+"px"
document.title=juliX+","+juliY
}
}
benshen.onmousedown=tuodong
</script>
</body>
</html>