[thelist] div properties in DOM1 browsers

Adam Davis adam at admataz.com
Sat Feb 17 05:28:03 CST 2001


hi all - can anyone help?
I'm having problems upgrading my site to the standards-compliant DOM used in
Netscape 6 and IE 5.

I have a <div> element with a unique id, which encases a body of text.
I want to know the height and the top position of the <div> element once the
text has rendered in the browser... (to scroll it - and let it stop when the
scrolling is done)

I use "document.getElementByID('id').style.height" to access the property,
but unless I explicitly initialize the height/top for that element through
javascript, or inline with a style attribute, the property remains empty...
I don't want to be explicit, because the length of my text may change, as
may the position of the div on the page.

I would previously access the "height" of a div using
"document.all[id]clientHeight" for IE4/5 or document.layers[id].clip.height
for NN4

I would access the "top" by using document.all[id].style.pixelTop for IE and
document.layers[id].top for Netscape.

Are there replacements for these in the W3 DOM?

*thought: Is this becase elements on HTML pages are all now strictly data
objects... is there a way to access the browsers' rendering of the element?

My homepage is the one I'm trying to update http://www.admataz.com It has a
scrolling element that works for the document.all and document.layers DOMs
(NN4;IE4;IE5 - not N6).  I've also posted a generic example that has all the
code on one page http://www.admataz.com/library/scrollboxes.html

I also started testing ways of accessing the style properties of divs:
http://www.admataz.com/library/testdivprops.html

thanks
ad (capetown, ZA)









More information about the thelist mailing list