Results 1 to 3 of 3

Thread: Switch Content Script

  1. #1
    Join Date
    Jun 2006
    Location
    UK
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Switch Content Script

    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; cursorointer"><span>

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

    PS: I am a complete beginner with javascript

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    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.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Jun 2006
    Location
    UK
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you djr33 - you pointed me in the right direction. I changed my doctype and now it validates. Cheers!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •