Here is code that clicks a link with IE4+ and NN6 (tested with NN6.2 I 
am not sure all the createEvent,dispatchEvent stuff works with NN6.0)

<html>
<head>
<title>
click
</title>
<script type="text/javascript">
function fireClickEvent () {
   if (document.all)
     document.links[0].click();
   else if (document.createEvent) {
     var evt = document.createEvent('MouseEvents');
     evt.initEvent ('click', true, true);
     document.links[0].dispatchEvent(evt);
   }
}
</script>
</head>
<body onload="fireClickEvent();">
<a href="http://JavaScript.faqts.com"; target="faqts">JavaScript.faqts</a>
</body>
</html>

Mikey Alexander wrote:

> I'm having two problems.
> 
> First, I'm trying to send click events to HTML Elements.  Specifically 
> HTML Anchors.  I assume I have to use dispatchEvent to do this.
> 
> Second, I'm getting an ERROR in my compiles:
> #include "nsIDOMEvent.h"
> 
> Thanks,
>      Mikey
> 


-- 

        Martin Honnen
        http://javascript.faqts.com/
        http://home.t-online.de/home/martin.honnen/jsgoddies.html


Reply via email to