Do you like my tutorials?

Then consider supporting me on Ko-fi

Talking about Javascript.

I had to display several photos where the user can click over an interesting point and have its coordinates passed through a form.
Of course, it was a bit more complicated, but this is the code i want to share with you.

Let’s assume we have a photo like this:

Try to click on a photo now…

You pointed on x = – y =

If you continue to click on the photo, you will see pointer changing its position, same thing with x and y coordinates

How can it be done?

You can try this script, obviously changing path and styles according to your needs






You pointed on x = - y =

Tested both on Firefox and Explorer, it seems to work well.

Enjoy and give me feedback.

Never miss an update! Subscribe, and I will bother you by email only when a new game or full source code comes out.