JavaScript Question...

Discussion in 'Mac Help/Tips' started by simX, Aug 14, 2002.

  1. simX macrumors 6502a


    May 28, 2002
    Bay Area, CA
    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? :D )?

    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.

    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. ;) )
  2. AmbitiousLemon Moderator emeritus


    Nov 28, 2001
    down in Fraggle Rock
    ok im completely off topic (sorry) but i red your rather long sig and saw you are the memory usage getter guy.

    i used to use that, but cant get it to work anymore. i alwasy put it in my fruit menu folder as the only item so i have memory usage in my apple menu just like in os9. still works on my powerbook but not my imac. both osx10.1.5 and both with uptodate applescript. any idea what is up with the imac?

Share This Page