HighDots Forums  

Re: assigning event with attachEvent instead of onmouseover

Javascript JavaScript language (comp.lang.javascript)


Discuss Re: assigning event with attachEvent instead of onmouseover in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Holger Jeromin
 
Posts: n/a

Default Re: assigning event with attachEvent instead of onmouseover - 06-10-2008 , 10:44 AM






webgour schrieb am 10.06.2008 17:01:

Quote:
I'm having difficulty using attachEvent instead of simply assigning to
mouseover in my object Sample03. When i use myImage.onmouseover =
this.showmouseover(); in the following all works fine, if I replace it by
myImage.attachEvent('onmouseover',this.showmouseov er()); I get for the
alert(this.id) "undefined" and not "gwlogo"
http://www.quirksmode.org/js/events_advanced.html

"The event handling function is referenced, not copied, so the this
keyword always refers to the window and is completely useless."

--
Mit freundlichen Grüßen
Holger Jeromin


Reply With Quote
  #2  
Old   
Thomas 'PointedEars' Lahn
 
Posts: n/a

Default Re: assigning event with attachEvent instead of onmouseover - 06-12-2008 , 05:40 PM






Holger Jeromin wrote:
Quote:
webgour schrieb am 10.06.2008 17:01:
I'm having difficulty using attachEvent instead of simply assigning to
mouseover in my object Sample03. When i use myImage.onmouseover =
this.showmouseover(); in the following all works fine, if I replace it by
myImage.attachEvent('onmouseover',this.showmouseov er()); I get for the
alert(this.id) "undefined" and not "gwlogo"

http://www.quirksmode.org/js/events_advanced.html

"The event handling function is referenced, not copied, so the this
keyword always refers to the window and is completely useless."
See also:

http://www.quirksmode.org/blog/archi...nt_consid.html


PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f806at$ail$1$8300dec7 (AT) news (DOT) demon.co.uk>


Reply With Quote
  #3  
Old   
RobG
 
Posts: n/a

Default Re: assigning event with attachEvent instead of onmouseover - 06-12-2008 , 09:39 PM



On Jun 11, 1:44 am, Holger Jeromin <news03_2... (AT) katur (DOT) de> wrote:
Quote:
webgour schrieb am 10.06.2008 17:01:

I'm having difficulty using attachEvent instead of simply assigning to
mouseover in my object Sample03. When i use myImage.onmouseover =
this.showmouseover(); in the following all works fine, if I replace it by
myImage.attachEvent('onmouseover',this.showmouseov er()); I get for the
alert(this.id) "undefined" and not "gwlogo"

http://www.quirksmode.org/js/events_advanced.html

"The event handling function is referenced, not copied, so the this
keyword always refers to the window and is completely useless."
The line above that on Quirksmode is not quite correct, it says (in
regard to the IE event model):

"Events always bubble, no capturing possibility."


When it should say:

"Events *only* bubble..."


Not all events bubble, and some events that bubble in other browsers
do not bubble in IE (such as the change event for form elements).


--
Rob


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.