Here is a good up-todate guide to this stuff 

http://www.xs4all.nl/~ppk/js/events_advanced.html

usual story - mozilla support DOM &  microsoft sucks...

mozilla method 

addEventListener("click",myfunction,false)

http://www.mozilla.org/docs/dom/domref/dom_el_ref31.html#1028304

microsoft

attachEvent("onclick",myfunction)

ho hum

Justin 


>>>>  I got a DOM/JS/x-browser question. I have a function that
> > > adds a button to a form using DOM.  I also what to add a
> > > onclick event to the button to run a function...
> > >
> > > here it is
> > >
> > > <script>
> > > function AddButton()
> > > {
> > >         var myinput= document.createElement("input");
> > >         myinput.setAttribute("type","button");
> > >         myinput.setAttribute("value","go");
> > >         myinput.setAttribute("onclick",function ()
> > > {alert('x')}); // line to change
> > >
> > >         document.getElementById("myform").appendChild(myinput);
> > >
> > > }
> > > </script>


-- 
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]

Reply via email to