日期:2014-05-16  浏览次数:20587 次

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 ;
     }

?