PDA

View Full Version : x,y coordinates in an image?



batman
11-20-2006, 07:53 PM
i need to display a map in a web page and recognize where the mouse give a click to obtain its position and then execute an event when this happens, is there any example to learn from it?

thanks a lot,

matt.

djr33
11-21-2006, 02:27 AM
within a form,
<input type="image" src="....jpg" name="imgname">

That, when clicked, will act like a "submit" button.
It will also send, along with the form values, imgname_x and imgname_y, values representing where it was clicked, where 0,0 is the top left corner.

This would work well with php, etc.

Not sure exactly how it works with javascript without submitting. I have seen it done, though, so I think there's a way.... just gotta adapt it to work in realtime.