PDA

View Full Version : Simulate mouse click?



evank3
11-07-2007, 05:54 AM
I really need help. I've been looking on the internet for hours trying to find a way to simulate a mouse click at a certain X,Y point on the webpage. Please if there's a way please show me. I'm extremely tired of searching all around the internet.

Thanks!
-evank3

Trinithis
11-07-2007, 05:12 PM
http://developer.mozilla.org/en/docs/DOM:element.dispatchEvent

I don't know if it works in IE. There probably is a version for it, but if there is, I'm not sure what it is. In any case you could always manually call the event handling functions yourself. The only issue would be that this could be a little cumbersome if there are many functions. An example of what I mean:


function clickHandler1(e) {/*do something*/}
. . .
clickHandler1({
pageX: 100,
pageY: 50,
target: document.getElementById("theTarget")
// All other necessary event attributes go here as well
});