Friday, June 24, 2005

Don't do these anymore

Six JavaScript features we do not need any longer. I still see plenty of instances of "javascript:" in modern JS code. My favorite is seeing it used in an event handler, like this:

<a href="#" onclick="JavaScript:doThis();">Do This!</a>

With capitalization, even. Hello?


At 2:23 PM, Blogger David said...

While I think that calling a function from a javascript: URL, I still think we need support for the JS "protocol". I often find myself creating a link with the DOM and having it execute some JS, so I use "javascript:;" as the URL. Sure, you can stop the event from bubbling up and following a link like "#", but squashing the need with just a "javascript:;" URL is nice.


Post a Comment

<< Home