Javascript offsetleft, offsettop, offsetwidth and offsetheight

1k views Asked by At

Can anyone tell me how Javascript methods "offsetleft", "offsettop", "offsetwidth" and "offsetheight" works in IE? How can we make them work properly in IE? Please tell me a suitable function for the same.

Thanks in advance !

This is my code...which gives different result in IE.

function getContainerWidth(container){
 var outerWrapWidth = container.offsetWidth;
     return outerWrapWidth;
 }
 function getContainerHeight(container){
 var outerWrapHeight = container.offsetHeight;
 return outerWrapHeight;
 }   
 function findPosX(ele){     
 var left = ele.offsetLeft;
 return left;
 }
 function findPosY(ele){
 var top = ele.offsetTop;
 return top;
 }  
var obj = document.getElementById('obj1');
console.log('width : '+getContainerWidth(obj))
console.log('height : '+getContainerHeight(obj))
console.log('left : '+findPosX(obj))
console.log('top : '+findPosY(obj))
0

There are 0 answers