Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. JavaScript
  4. Find X,Y position of a element

Find X,Y position of a element

Scheduled Pinned Locked Moved JavaScript
tutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    yesu prakash
    wrote on last edited by
    #1

    Hi, How to find the Find X,Y position of a element, which is working both in IE and Firefox. Codes from net not working in mozilla. Thankyou

    T G 2 Replies Last reply
    0
    • Y yesu prakash

      Hi, How to find the Find X,Y position of a element, which is working both in IE and Firefox. Codes from net not working in mozilla. Thankyou

      T Offline
      T Offline
      twseitex
      wrote on last edited by
      #2

      use property .style (CSS) complete HTML and DHTML reference for IE see http://msdn.microsoft.com/en-us/library/ms533050.aspx .position see http://msdn.microsoft.com/en-us/library/ms531140.aspx

      1 Reply Last reply
      0
      • Y yesu prakash

        Hi, How to find the Find X,Y position of a element, which is working both in IE and Firefox. Codes from net not working in mozilla. Thankyou

        G Offline
        G Offline
        Graham Breach
        wrote on last edited by
        #3

        Try this:

        var e = document.getElementById(id), x = e.offsetLeft, y = e.offsetTop;
        while(e = e.offsetParent) {
        x += e.offsetLeft;
        y += e.offsetTop;
        }

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups