Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2005
    Location
    Leeds
    Posts
    3,423
    Tokens
    0

    Latest Awards:

    Default Getting the x/y of any div...

    Is there a way of getting the x/y of any div using javascript? Could anyone link me to a tutorial or code me something quickly.

    Thanks
    Danny

  2. #2
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:


  3. #3
    Join Date
    Mar 2005
    Location
    Leeds
    Posts
    3,423
    Tokens
    0

    Latest Awards:

    Default

    Doesnt work on Firefox, sadly.

  4. #4
    Join Date
    Dec 2006
    Posts
    521
    Tokens
    0

    Default

    Meh i found this but it seems like a lousy way of doing it:

    http://www.howtocreate.co.uk/emails/DavidBerman.html

  5. #5
    Join Date
    Aug 2004
    Location
    UK
    Posts
    11,283
    Tokens
    2,031

    Latest Awards:

    Default

    Its easy to do via the DOM. How are you positioning the div to stat with though? Absoulte? relative? etc?
    If by css you may use for example.

    Code:
    <style>
    #box {
    position:absolute;
    left:50px;
    top:20px;
    }
    </style>
    <div id="box"></div>
    You could get the values by.

    topval = document.getElementById('box').style.top;
    leftval = document.getElementById('box').style.left;

  6. #6
    Join Date
    Dec 2006
    Location
    Kent, UK
    Posts
    627
    Tokens
    138
    Habbo
    Romanity

    Latest Awards:

    Default

    Using your method Entor, how would you then go on to echo out the values?

  7. #7
    Join Date
    Aug 2004
    Location
    UK
    Posts
    11,283
    Tokens
    2,031

    Latest Awards:

    Default

    Youd use js to take data to and from the page and the php script.

Posting Permissions

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