471,071 Members | 1,018 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,071 software developers and data experts.

Putting mouse coordinates in URL

22
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
4 1505
acoder
16,027 Expert Mod 8TB
See Mouse position during an event.
May 27 '08 #2
hsriat
1,654 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
16,027 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
1,654 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 Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.