ChrisDrake
asked on
Can I simulate a click on a web page at any given coordinate (X,Y position) ?
I have the following information:
A) a bunch of information in HTML
B) the browser width in pixels
C) the X/Y coordinate that the users wants to click on
Can I insert script (preferably fired by the onLoad event) into the HTML so that a click is simulated?
The user might be clicking a link, or trying to focus the mouse on a form input field, or pressing a button, or whatever - I don't know what in advance - only the X,Y coordinate.
In case you're wondering why - I have an archive of web page thumbnails (the HTML together with a "screen-shot" GIF image) and I want to make them "functional" when clicked. This is the component I used to capture the GIF of the page: http://www.guangmingsoft.com/htmlsnapshot/help.htm
If you know for sure that this is impossible, please say (if you can explain why, that would be nice too :-)
A) a bunch of information in HTML
B) the browser width in pixels
C) the X/Y coordinate that the users wants to click on
Can I insert script (preferably fired by the onLoad event) into the HTML so that a click is simulated?
The user might be clicking a link, or trying to focus the mouse on a form input field, or pressing a button, or whatever - I don't know what in advance - only the X,Y coordinate.
In case you're wondering why - I have an archive of web page thumbnails (the HTML together with a "screen-shot" GIF image) and I want to make them "functional" when clicked. This is the component I used to capture the GIF of the page: http://www.guangmingsoft.com/htmlsnapshot/help.htm
If you know for sure that this is impossible, please say (if you can explain why, that would be nice too :-)
ASKER
Yes - that's right.
My "someAction.pl" will then return to the browser the original HTML that produced snapshot.jpg along with some extra javascript code - the javascript code will re-size the window to the dimentions that the snapshot were taken in, then (and this is the bit I don't know how to do) - it needs to simulate a mouse click at 324x483
Obviously I'll need to "un-scale" my snapshots to work out what the real X,Y coordinates will be, so for the sake of this exercise, just pretend that the snapshot is not scaled down in any way and pretend I can use X,Y as they are.
My "someAction.pl" will then return to the browser the original HTML that produced snapshot.jpg along with some extra javascript code - the javascript code will re-size the window to the dimentions that the snapshot were taken in, then (and this is the bit I don't know how to do) - it needs to simulate a mouse click at 324x483
Obviously I'll need to "un-scale" my snapshots to work out what the real X,Y coordinates will be, so for the sake of this exercise, just pretend that the snapshot is not scaled down in any way and pretend I can use X,Y as they are.
That is not afaik possible
What you need to do is to find what it was under the mouse
If a form button:
document.forms[0].button1. click()
or a link:
document.links[12].click()
but if you could make the browser click anywhere, it would be a security problem
Michel
What you need to do is to find what it was under the mouse
If a form button:
document.forms[0].button1.
or a link:
document.links[12].click()
but if you could make the browser click anywhere, it would be a security problem
Michel
ASKER
Obviously I mean only to click someplace within the browsers client area (ie: on the web page it's displaying).
It's not a security problem to click anyplace on a web page.
(Assuming Microsoft has fixed most of it's bugs by now :-)
I don't know any way to do this, and google didn't tell me either... it's always hard trying to find how to do something that's impossible, because nobody says it's impossible, so you just have to keep looking until you give up:-)
Every now and then however, I do manage to solve "impossible" problems (like my last one: manually creating a "system-restore-point" - it only took me 3 lines of vbscript - and although nobody else in the world seems ever to have done this (according to google) I did work it out after a day of sleuthing...)
I live in hope :-)
It's not a security problem to click anyplace on a web page.
(Assuming Microsoft has fixed most of it's bugs by now :-)
I don't know any way to do this, and google didn't tell me either... it's always hard trying to find how to do something that's impossible, because nobody says it's impossible, so you just have to keep looking until you give up:-)
Every now and then however, I do manage to solve "impossible" problems (like my last one: manually creating a "system-restore-point" - it only took me 3 lines of vbscript - and although nobody else in the world seems ever to have done this (according to google) I did work it out after a day of sleuthing...)
I live in hope :-)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Wow - complicated but this has extreme potential to solve my problem!!!!
<input type="image" src="snapshot.jpg">
</form>
will send x=324,y=483 to someAction if the user clicks on pos 324x483
Michel