Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Oct 2003
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    I equivalent for pageXOffset

    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!

  • #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    Not sure if this is what you want, but this is what I use to find the spot of an element on the page.

    Code:
    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

  • #3
    New Coder
    Join Date
    Oct 2003
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    is offsetTop the IE equivalent to NS window.pageYOffset?

    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!

  • #4
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •