`
renyanwei
  • 浏览: 70117 次
  • 性别: Icon_minigender_1
  • 来自: 郑州
社区版块
存档分类
最新评论

JAVAScript得到控件的坐标

阅读更多
function getAbsoluteHeight(ob){
         return ob.offsetHeight
}
function getAbsoluteWidth(ob){
     return ob.offsetWidth
}

     function getAbsoluteLeft(ob){
         var mendingLeft = ob .offsetLeft;
         while( ob != null && ob.offsetParent != null && ob.offsetParent.tagName != "BODY" ){
             mendingLeft += ob .offsetParent.offsetLeft;
             ob = ob.offsetParent;
         }
         return mendingLeft ;
     }
     function getAbsoluteTop(ob){
         var mendingTop = ob.offsetTop;
         while( ob != null && ob.offsetParent != null && ob.offsetParent.tagName != "BODY" ){
             mendingTop += ob .offsetParent.offsetTop;
             ob = ob .offsetParent;
         }
         return mendingTop ;
     }

 

2
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics