SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    May 2011
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    XHTML onload validation issue

    I'm trying to validate the following URL, please see:

    http://www.tenthtime.co.uk/

    I'm down to one final issue, a javascript onload which is resulting in the error "there is no attribute 'onload'".

    [Invalid] Markup Validation of http://www.tenthtime.co.uk/ - W3C Markup Validator

    I originally assumed this was due to the fact that OnLoad was capitalized, however changing this has no affect.

    Advice appreciated.

    Thanks!
    Last edited by Mittineague; May 26, 2011 at 15:54. Reason: OP forgot to turn off auto-title

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,147
    Mentioned
    190 Post(s)
    Tagged
    2 Thread(s)
    Try taking the inline onload out of the mark-up and using an event handler. Much cleaner.

  3. #3
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,346
    Mentioned
    179 Post(s)
    Tagged
    6 Thread(s)
    Quote Originally Posted by Tenth Time View Post
    I originally assumed this was due to the fact that OnLoad was capitalized, however changing this has no affect.

    Advice appreciated.

    Thanks!
    onload will validate in an xhtml doctype but but onLoad will not. It needs to be lowercase and should have resolved the problem but as Alan said above an event handler is a better way to handle things.

  4. #4
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,807
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    While "onload" will validate it is still better to NOT jumble JavaScript with (X)HTML and to instead keep them in separate files with only the <script> tag to link them together..
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


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
  •