[Javascript] CSS positioning in IE6 and NN6

Rees, Mark (TWIi London) mrees at twii.net
Fri Jul 6 06:08:07 CDT 2001


Hello

I have defined the position of a div using a stylesheet, and I'm trying to
access its properties. In NN4 I have no problems with this, but NN6 and IE6
will not give me the information. The only way I can access the properties
in those browsers is to define the properties of the div using an inline
style, which is not much use to me.

The syntax I am using to define the div is as follows (in an external
stylesheet):

#div1{position: absolute;
	left: 20px;
	top: 100px;
	width: 200px;
	height: 300px;
	clip: rect(0px 200px 100px 0px);
	visiblity: visible;
	z-index: 1;
	background-color:#FF0000;
	layer-background-color:	#FF0000;
	}

Then comes the html for the div,

div id="div1">Where am I?</div

and after that I try to get the top property like so:

ie6: div1.style.top; //returns nothing
NN6: document.getElementById('div1').top	//returns undefined
NN4: document.layers['div1'].top //returns 100

This is a newbie question so apologies in advance if I am missing something
very obvious.

Thanks for any help you can give me

Mark




More information about the Javascript mailing list