hello forums!!
I am wondering to know -
how to find the position of coordinate on clicked position ? using javascript.
Case:
Suppose i had a image ,when mouse is clicked @ certain position of image, then it should alert the x & y coordinate of that point..
Awaiting for your great help..
Thanks in advance to all of you
how to find the position of coordinate on clicked position ?
Moderator: General Moderators
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
Could you use image slices and an imagemap? Check out: http://www.ihip.com/
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
could use an <input type="image"/> to submit to the server. It reports the x & y of where you clicked the image in the GET/POST request. unfortunately, there's no javascript interface I know of.
Maybe you could embed it in a form with an onsubmit handler that intercepts the POST and cancels it? Not sure if it would work... but it's worth investigating!
Maybe you could embed it in a form with an onsubmit handler that intercepts the POST and cancels it? Not sure if it would work... but it's worth investigating!
-
mandar-seo
- Forum Newbie
- Posts: 6
- Joined: Mon Jun 19, 2006 11:59 pm
- Location: pune, india
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
From what I understand the image button only send click coordinates in IE (though I could be wrong).
I did find this little gem whilst asking my good buddy Google if he knew anything about 'Javascript capture click coordinates'. I am wondeing if that could be useful to you.
I did find this little gem whilst asking my good buddy Google if he knew anything about 'Javascript capture click coordinates'. I am wondeing if that could be useful to you.
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
Say what? There are like, a dozen attributes of a mouse click... Somewhere along the line, the math should be able to give you the correct coordinates. It's just.. a lot of trial and error (for me). clientX, clientY, scrollX, scrollY, scrollLeft, scrollTop, layerX, layerY, and a bunch of other ones. Match them up with the image's position, and you should be able to come up with the correct coordinates.... Or, am I misinterpreting the topic?