RobB wrote:
[snip]
DOM Level 2 has expanded capabilities in this area, someone will
doubtless mention them here...
I take it you're referring to event simulation with the DOM Events
module, which would go something like:
var e = document.createEvent('MouseEvents'),
a = document.links['anchor1'];
e.initMouseEvent('click', /* Event type */
true, /* Can bubble */
true, /* Cancelable */
document.defaultView, /* View */
1, /* Mouse clicks */
0, /* Screen x */
0, /* Screen y */
0, /* Client x */
0, /* Client y */
false, /* Ctrl */
false, /* Alt */
false, /* Shift */
false, /* Meta */
0, /* Button */
null); /* Related target */
a.dispatchEvent(e);
Yes, in theory you could do that, however it's not likely it will "do"
anything. Any event listeners attached to the document (both capturing
and non-capturing) will be fired, but the default action associated
with the event is not likely to occur. This prevents a malicious
script from faking a mouse click to open a pop-up window or submit a
form, for example.
Mike
--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.