SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2006
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to pass mouse coordinates to a JavaScript function?

    I have a link, that when the user clicks on it, calls a JS function.

    <a href="#" onload="ShowPopup();">Click</a>

    I'd like to pass the x,y mouse coordinates of the click to the function....so the PopUp shows where the user clicked. Something like:

    <a href="#" onload="ShowPopup(mouse.x, mouse.y);">Click</a>

    Anyone know how to do this?

    Thanks!

  2. #2
    SitePoint Guru
    Join Date
    Sep 2006
    Posts
    731
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by MetalGod View Post
    I have a link, that when the user clicks on it, calls a JS function.

    <a href="#" onload="ShowPopup();">Click</a>

    I'd like to pass the x,y mouse coordinates of the click to the function....so the PopUp shows where the user clicked. Something like:

    <a href="#" onload="ShowPopup(mouse.x, mouse.y);">Click</a>

    Anyone know how to do this?

    Thanks!
    I think you'll find that this script makes that happen: Link
    Tab-indentation is a crime against humanity.


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
  •