Forum Moderators: open
I use JavaScript for my DOM work, I'm kinda new to DOM and was wondering if there is a method to get the height, in pixels, of a <div>.
I'm trying to make a scrolling web widget, or some kind of output control for a shoutbox type of thing.
Also, does anyone know of a good DOM reference, when I look at other people's scripts I see stuff I never knew existed. I usually use W3Schools but they don't have much on DOM.
Take care,
Emperor
A generally more practical guide for real-world implementations is the Danny Goodman book Dynamic HTML on O'Reilly.
Probably the most reliable way to determine the height or width of an element is not part of the standardized DOM, but is a fairly standard part of browsers' DOM implementations, offsetHeight and offsetWidth Usually these values are extracted through the use of the element's ID, as in:
var elem_ht=document.getElementById("element_id").offsetHeight;