View Full Version : Switch Content Script

06-28-2006, 12:25 PM
I am using the switch content script to expand/collapse my news archives. The code works perfectly and is just what I was looking for. I have put the code in a separate .js file and linked it to my html page. When I try to validate this page I get this error message:

Error Line 252, column 12: there is no attribute "onClick".

<h5 onClick="expandcontent(this, 'sc3')" style="cursor:hand; cursor:pointer"><span>

Can anyone help me make this page validate? Any ideas are much appreciated.

PS: I am a complete beginner with javascript

06-28-2006, 12:31 PM
Likely you need a valid doctype. It's basically saying what version of html (or xml) you are using. If none is supplied, it reverts to an older one, which doesn't include onClick, and lots of other stuff.

06-28-2006, 04:04 PM
Thank you djr33 - you pointed me in the right direction. I changed my doctype and now it validates. Cheers!