Get width and height of element

  • Thread starter Thread starter Alejandro Penate-Diaz
  • Start date Start date
A

Alejandro Penate-Diaz

Hi. Is there any way of getting an element real size from javascript, when
this element was previously assigned a width and height of 100%?
Thanks,
Alex.
 
In IE you can use the getBoundingRect() method. Look ut up on MSDN for
documentation and examples. In most cases, you can use offsetHeight and
offsetWidth of the element, like

var e = document.getElementById("myDiv");
alert(e.offsetHeight);
alert(e.offsetWidth);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top