SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Evangelist vhogarth's Avatar
    Join Date
    Nov 2003
    Location
    Taxachussets
    Posts
    415
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to find the location on a page of an element

    Ive created an error checking function for my specific elements that are triggered by the onchang event. I created a hiddin div that becomes visible in the event of an error and displays the error message.

    The problem im having is with properly placing where the div should go. I tried to absolute position the div under the text field that it displays the errors for, but depending on whether a window is maximized or not, it doenst line up. if i put the div within the table <TD> it makes makes the cell bigger even if there is nothign displayed in the div yet.

    Basically how do i use javascript to find the location on the page where the text field is so that i can offset the div either above it or below it all the time, regardless of window height/width?

    Is there an option for that?

    BTW, this only has to work in IE, so i dont need to ensure complete browser compatibility just IE 6.

  2. #2
    SitePoint Evangelist vhogarth's Avatar
    Join Date
    Nov 2003
    Location
    Taxachussets
    Posts
    415
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Found it. offsetLeft and offsetTop worked out. Hope someone else gets some use out of it.


Bookmarks

Posting Permissions

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