[thelist] setAttribute(someevent) in IE?

Peter-Paul Koch gassinaumasis at hotmail.com
Wed Jun 2 09:22:27 CDT 2004



>On Tuesday 01 June 2004 02:16 pm, liorean wrote:
> > In cases where you want to send it an argument,
> >     document.getElementById('thelink').onclick=function(e){
> >         e=e||window.event;
> >         /*code to run when the event triggers*/
> >     };
>
>thanks - but what if foo() is actually a really complicated function and
>is also called by events on other elements? Basically I really want to
>have a single function definition.
>
>I tried the old
>==
>elem['onclick'] = new function() { foo(arg) };
>==
>but this actually _calls_ foo(arg) on page load. hmm.


elem.onclick = function () {foo(arg)}


-------------------------------------------------------------------
ppk, freelance web developer
Interaction, copywriting, JavaScript, integration
http://www.quirksmode.org/
Column "Keep it Simple": http://www.digital-web.com/columns/keepitsimple/
------------------------------------------------------------------

_________________________________________________________________
Talk with your online friends with MSN Messenger http://messenger.msn.nl/



More information about the thelist mailing list