I have an HTML page generated by a perl script (the image is a plotted graph), and I want to make it a bit interactive, in a limited sort of way.
All I want to be able to do is to have the user click on the script, and get the values of the graph at that point (i.e.: the x-value and the y-value of where the user clicked).
If I can manage just to get the position of the cursor relative to the top-left corner of the graph when the user clicks on it, I think it should just be some easy math to get the x-value and y-value to display in a text field from there.
Does this sound feasible? And if so, can someone point me to some resources where I can figure out how exactly to do this (or could you outright show me how to do it?
)?
I found this script that gives the mouse position of the browser window when you move your mouse around. So maybe someone can help me modify it so that it does it only when you click on an image, and it only gives you the position from the top-left corner of the image rather than the whole browser window.
http://www.scriptsearch.com/cgi-bin/jump.cgi?ID=4717
Thanks for any help in advance. (BTW, it won't be too difficult to include this in a perl script, so if you just use a straight HMTL file to do the trick, I can easily modify my perl script to produce the same effect. Just use some random image like the PowerMac on Apple's front page.
)
All I want to be able to do is to have the user click on the script, and get the values of the graph at that point (i.e.: the x-value and the y-value of where the user clicked).
If I can manage just to get the position of the cursor relative to the top-left corner of the graph when the user clicks on it, I think it should just be some easy math to get the x-value and y-value to display in a text field from there.
Does this sound feasible? And if so, can someone point me to some resources where I can figure out how exactly to do this (or could you outright show me how to do it?
I found this script that gives the mouse position of the browser window when you move your mouse around. So maybe someone can help me modify it so that it does it only when you click on an image, and it only gives you the position from the top-left corner of the image rather than the whole browser window.
http://www.scriptsearch.com/cgi-bin/jump.cgi?ID=4717
Thanks for any help in advance. (BTW, it won't be too difficult to include this in a perl script, so if you just use a straight HMTL file to do the trick, I can easily modify my perl script to produce the same effect. Just use some random image like the PowerMac on Apple's front page.