|
-
Aug 28th, 2001, 09:37 AM
#1
Thread Starter
Addicted Member
JScript : Getting img X & Y
I've got an image, which act as a map and i need to find the coordinate relative to the img when user click on it.
I've successfully manage to get the document coord (x & y) but can't get the img coord, any idea ?
Code:
function GetCoord(e)
{
var x = (navigator.appName.substring(0,3) == "Net") ? e.pageX : event.x+document.body.scrollLeft;
var y = (navigator.appName.substring(0,3) == "Net") ? e.pageY : event.y+document.body.scrollTop;
x = x - document.frmAjout.imgCarte.scrollLeft;
y = y - document.frmAjout.imgCarte.scrollTop;
document.frmAjout.txtCoordX.value = x;
document.frmAjout.txtCoordY.value = y;
}
-
Aug 28th, 2001, 10:51 AM
#2
Frenzied Member
-
Aug 28th, 2001, 11:18 AM
#3
Thread Starter
Addicted Member
Those scripts don't seem to work 
I can get the screen x,y
But i'd like to be able to get the x&y relatibve to the images without submitting the form...
Like x = x - img.left
y = y - img.top
Then i got the img x & y
Thanks for the reply
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|