467,868 Members | 1,291 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,868 developers. It's quick & easy.

Putting mouse coordinates in URL

Hi,

I'm working on a project in which I'd like to have the user's mouse click coordinates included in a php URL which would load onClick, for example http://...imagecreate.php?x=200&y=100. I've seen several scripts dealing with mouse coordinates, but can't seem to make things work with this. Can anyone help? Thanks...
Nov 5 '06 #1
  • viewed: 1389
Share:
4 Replies
acoder
Expert Mod 8TB
hsriat
Expert 1GB
But if you want to get the mouse coordinates when clicked on a particular image, use that image as input.

ie.[html]<form action="target.php">
<input type="image" src="/images/imageName.png" />
</form>[/html]
When clicked, your url will look like target.php?x=33&y=21

Where x and y are the coordinates where the user clicked on the image.
May 27 '08 #3
acoder
Expert Mod 8TB
If we're talking about a number of images, the form image element would have to be updated onclick. We would also need to work out the image position within the page for the offsets, though I think the OP wanted to load the new page onclick. Useful discussion all the same.
May 27 '08 #4
hsriat
Expert 1GB
If we're talking about a number of images, the form image element would have to be updated onclick.
Not really, we can give different names to different images.
eg. if image name is "myimage", it will give parameters as myimage_x and myimage_y. I mean, it would suffix _x and _y to the image name when clicked, and submit the form.

We would also need to work out the image position within the page for the offsets, though I think the OP wanted to load the new page onclick.
That's what we can think next, depending upon the exact needs of OP.
May 27 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

10 posts views Thread by Danny | last post: by
3 posts views Thread by mitsura | last post: by
7 posts views Thread by RobKinney1 | last post: by
2 posts views Thread by quickcur | last post: by
18 posts views Thread by eliss.carmine | last post: by
3 posts views Thread by wanwan | last post: by
4 posts views Thread by =?Utf-8?B?Unlhbg==?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.