模块所在位置距离

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
#box{
width: 100px;
height: 100px;
border: 1px solid #FF0000;
position: absolute;
top:100px;
left: 100px;
}
</style>
</head>
<body>
<div id="box">

</div>
<script type="text/javascript">
var obox = document.getElementById("box")
alert(obox.offsetLeft)
alert(obox.offsetTop)
alert(obox.offsetHeight)
alert(obox.offsetWidth)


</script>
</body>
</html>

posted @ 2017-03-10 11:06  张正-博客园  阅读(103)  评论(0编辑  收藏  举报