[Javascript] Get HTML element size

Simone Fumagalli simone at tomato.it
Tue Mar 8 03:41:29 CST 2005


Ciao javascript,

  How do I get the width and the height of a element in my page ?

  Suppose I have this HTML:

       <div id="mydiv">
           <p>Hello people !!</p>
       </di>

  with this JS code :

       my_element = getElementById("mydiv");
       alert (my_element.style.width)

  I get an empty string :-(

Suggestions ?

-- 
Simone - simone at tomato.it




More information about the Javascript mailing list