Results 1 to 5 of 5

Thread: mouseOver ImageCoordinates

  1. #1
    Join Date
    Nov 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default mouseOver ImageCoordinates

    It seems so simple, and I thought I would be able to find help on the net, but it appears that I am wrong. I have an image and when the mouse is over the area coordinates I want it to show the x and y coordinates for that image in a div tag.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by markmil2002 View Post
    when the mouse is over the area coordinates
    What area coordinates? Is this an image map, or are you speaking in generic, rather than technical terms?
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Nov 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    it's an image map.

  4. #4
    Join Date
    Dec 2006
    Posts
    47
    Thanks
    1
    Thanked 3 Times in 3 Posts

    Default

    I have a compact script I use while editing with IE. No sense having it cross browser when it's only a local utility. Just paste the stuff in the page you're editing and take it out when you're done. You'll have to tweak it a bit to make it work over your specific div...
    PHP Code:
    <script type="text/javascript">
    document.onmousemove Kcur;
    function 
    Kcur() {
    X=event.clientX+document.body.scrollLeft;
    Y=event.clientY+document.body.scrollTop;
    kxy.innerHTML=" Top="+Y+"<br> Left="+X+"";
    kxy.style.pixelTop=Y;kxy.style.pixelLeft=X;
    return 
    true;
    }
    </script>
    <div id="kxy" style="border:1px inset ;position:absolute;padding:2px;font-family:fixedsys;"> </div> 

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by Kenny View Post
    I have a compact script I use while editing with IE. No sense having it cross browser when it's only a local utility. Just paste the stuff in the page you're editing and take it out when you're done. You'll have to tweak it a bit to make it work over your specific div...
    That might do the trick here, but that would be up to markmil2002 to decide.

    Personally, I'm still not clear on what is wanted here or why. The why isn't so important, except that it would help me a lot with the how. The what is important. Do you want this for the live page, or as Kenny is offering, only as a diagnostic tool? If for a live page, it would need to be cross browser, and probably only active while over specific area tags. Do you want the actual mouse coords relative to the page, the coords of the area tag, or the coords of the mouse relative to the image with the top left edge of the image being 0, 0? If Kenny's idea doesn't 'do it' for you, please be more specific as to what is required and why.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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
  •