...

View Full Version : IE equivalent for pageXOffset



skidvd
10-20-2003, 04:51 PM
What are the IE equivalents for the Netscape window.pageXOffset and window.pageYOffset properties - or the equivalent method of calculating the same value in IE?

Thanks!

A1ien51
10-20-2003, 06:27 PM
Not sure if this is what you want, but this is what I use to find the spot of an element on the page.



function ErrorPosition(ErrorElement){
ErrorPosX = ErrorElement.offsetLeft
ErrorPosY = ErrorElement.offsetTop;
ErrorWidth = ErrorElement.clientWidth;
if(!ErrorWidth){ErrorWidth = ErrorElement.offsetWidth;}
TheElement = ErrorElement.offsetParent;
while(TheElement != null){
ErrorPosX += TheElement.offsetLeft
ErrorPosY += TheElement.offsetTop;
TheElement = TheElement.offsetParent;
}
ErrorPosX += ErrorWidth;
return ErrorPosX +"|"+ ErrorPosY;
}



Eric

skidvd
10-20-2003, 06:36 PM
I need to determine the top of the browser window relative to the position that a document has been scrolled to in that window. In NS, I use the window.pageYOffset attribute for this purpose.

Does the offsetTop attribute provide the same value in IE? If so, where can I find this element - it does not appear to be listed in any of the docs I'm looking at? If not, what does?

Thanks!

A1ien51
10-20-2003, 07:44 PM
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/properties/offsettop.asp



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum