www.webdeveloper.com
Results 1 to 3 of 3

Thread: How to determine x,y of and Anchor

  1. #1
    Join Date
    Jun 2003
    Posts
    2

    Question How to determine x,y of and Anchor

    Hi, I have to migrate a menu function cuurently working fine in NS 4.x to IE. What I am looking for is how to determine the x,y coordinate of an HTML anchor, I've combed JScript reverences to no avail. I use the following for NS:

    document.mylayer.visibility = "visible"
    // anchorName is is filled by backend
    // script builder...
    xname = "document.anchors."+anchorName+".x"
    yname = "document.anchors."+anchorName+".y"
    eval("x = " + xname)
    eval("y = " + yname)
    document.mylayer.moveTo(x+20, y-7)

    I'd appreciate any info on how to accomplish the same for IE...

    Thanks in advance and best regards,
    Jim W.

  2. #2
    Join Date
    Dec 2002
    Location
    Calgary, Canada
    Posts
    6,120
    In the generation 6+ browsers
    object.offsetLeft and obj.offsetTop will give you the required info
    Cheers

    Khalid

    Message Posting Guidelines In These Forums, Please read these before posting any question.
    Web site: webapplikations.com
    Web Resources Page:Web Resources

  3. #3
    Join Date
    Jun 2003
    Posts
    2
    Thanks Dave, Khalid Ali for responding. I had investigated the offsetLeft and offsetTop and wondered why 1 was always returned.

    Dave thanks for the link... the loop on the offset.parent to get the true offset worked.

    Dave, FYI, I inherited the initial code and just wrote the back-end script processor around it a few years ago. Now that I have to mess with it I will definately incorporate your suggestion...



    Best regards,
    Jim W

    Self proclaimed halffast web programmer...


    Sorry guys I would have responded sooner, for some reason I couldn't get through the FW until today...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles