The rants of a constantly ticking mind, combined with a mess of reviews and obscure titling methods.

Monday, February 11, 2008

After hours of trying to find out why my program didn't work...

... it turns out that onclick does not have a captial C.


Blogger Dan said...

Yeah, always a fun one. Years of HTML4 have tricked people into thinking onClick and onMouseOver are valid in XML, which of course they aren't.

This applies to all XML, including XHTML. All attributes of elements must be lowercase, must be in name=value pairs, and the value must be enclosed in quotes.

The best piece of advice I can give when coding javascript is to wrap all code in possibly multiple layers of try/catch blocks, and to run the code within a debugging environment. Catch those errors!

6:02 pm


Post a Comment

<< Home

All contents (C)2004-07 Rich Jeffery & Chrissey Harrison. Please ask permission before copying.