|Posted by:||Csaba2000 (ne…@CsabaGabor.com)|
|Date:||12 Jul 2003|
I'd like to be able to simulate a mouse click on an arbitrary HTML element (for the purpose of invoking whatever
behaviour that element would have, had a real mouse click come to it) so that my click event will contain mouse
coordinates (I only need this for IE 5.5+)
In most cases, if domElem is the element, I can do domElem.click and I get the desired behaviour (e.g. buttons) so I
don't need the mouse coordinates. However, if I have an <input type=image ...> element then the normal behaviour is
to actually send the x and y coordinates to the server when the corresponding form is submitted (Sprint.com uses this
type of button to confirm credit card payments). Doing .click on that element will submit 0 for the x and y
coordinates. So will hitting the space bar when that element has focus (so a non mouse user is effectively barred
from making online payments to Sprint).
Csaba Gabor from New York
I'm actually doing this by means of an external VB/VBScript application that gets ahold of the web page on the
client's (that is my) machine. The point is that my little app is allowed to do things like get references to DOM
elements and invoke their methods.