Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In this way you can attach just one function to the event. Other way allows for more flexibility.

Alright. To me it sounded a bit like onmouseover was used only by bad programmers.



I'm kinda curious why you would ever use onmouseover when attachEvent/addEventListener are available? I just took out the remaining calls to .onEvent handlers in websearch's JS library - the only browsers that don't support the W3C/IE event models are so ancient that they don't get JS anyway, and there's not much point using a method that's unnecessary on modern browsers and does the wrong thing anyway.

So yeah, my interviewer wasn't implying that onmouseover is used only by bad programmers, but I am. ;-)


Maybe I only need one event handler, or maybe I've baked a function that calls another function?

Besides, I'd rather use one standard method that works across browsers than choose one based on the user's browser. Would you call that bad programming? :p

Nowadays I generally use jQuery (.click(fn)) though.


Ah, okay. Most of the stuff I've worked on adds events through a library (eg. jQuery.click(fn)), and there's no reason for that library to use onmouseover etc.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: