#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Location
    UK
    Posts
    1
    Rep Power
    0
    hey..

    i`m looking for a peice of code to get the X & Y co-ords of an image or Anchor in Javascript, i figuire its got to be possible.. i`m just not entirely sure how.. if anyone could help me out here it would be much appreciated

    Apoc
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    34
    Rep Power
    14
    Yes, you can! I have an example at http://www.sitesuwant.com/exampleXY.html. You can get the x and y of an image with this code inside the script tag:

    document.theForm.xCoor.value=window.event.x;
    document.theForm.xCoor.value=window.event.y;

    In the body:

    <b>Click X:</b> <input type="Text" name="xCoor" disabled><br>
    <b>Click Y:</b> <input type="Text" name="yCoor" disabled>

    ...and that should give you the proper response. This will only work in Internet Explorer 3+ I believe, so if you want Netscape too, tell me and I'll try to figure something out in Javascript for Netscape...

    Devin www.sitesuwant.com
    sitesuwant@sitesuwant.com

    [This message has been edited by kenowhere (edited September 04, 2000).]

Similar Threads

  1. Replies: 0
    Last Post: January 6th, 2004, 02:05 PM
  2. External JavaScript file problem
    By FTK2003 in forum JavaScript Development
    Replies: 11
    Last Post: September 13th, 2003, 11:21 AM
  3. External JavaScript file from within a JavaScript function?
    By DKDiveDude in forum JavaScript Development
    Replies: 10
    Last Post: August 19th, 2003, 03:24 AM
  4. delimiting javascript
    By scream in forum JavaScript Development
    Replies: 3
    Last Post: August 15th, 2003, 04:03 PM
  5. getting javascript error when using PHP and javascript
    By Dalamar in forum JavaScript Development
    Replies: 8
    Last Post: December 17th, 2001, 07:41 AM

IMN logo majestic logo threadwatch logo seochat tools logo