[Javascript] attachEvent and "this"

Julien Nadeau junado at junado.com
Fri Aug 12 11:04:06 CDT 2005


Thanks,

somehow, I knew there had to be a way to get more information from  
the "e", but had no idea how to do it.

Just a small correction, since JS seems to be case sensitive, it  
should have been e.srcElement (capital "E").

Thanks again,

Julien Nadeau
junado at junado.com

Le 05-08-12 à 11:39, Matt Warden a écrit :

> On 8/12/05, Julien Nadeau <junado at junado.com> wrote:
>
>> My question is, using unobstrusive event handlers, how can I get  
>> to use the
>> "this" keyword in Internet Explorer 6 so that I can get the info  
>> contained
>> in the "dest" attribute. Is there's a way?
>>
>
> function bar(e) {
>   // if e parameter isn't defined, use IE's 'event' var
>   e = e || event;
>   alert("The source element's id is: "+ (e.srcelement || e.target).id)
> }
>
> document.getElementById('foo').onclick = bar;
>
> In IE, 'event' is a "global" reference to the current event.
>
> -- 
> Matt Warden
> Miami University
> Oxford, OH, USA
> http://mattwarden.com
>
>
> This email proudly and graciously contributes to entropy.
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20050812/2d261c71/attachment.htm>


More information about the Javascript mailing list