Results 1 to 2 of 2

Thread: onload attribue generating W3C Validation error with XHTML Transitional 1.0 doctype

  1. #1
    Join Date
    May 2010
    Posts
    2

    onload attribue generating W3C Validation error with XHTML Transitional 1.0 doctype

    Hello, everyone!

    I'm co-developing a WordPress blog, to which we have added a Frontpage Slideshow (FPSS) plugin to display featured posts.

    Before adding this feature, the blog was validating beautifully on the W3C Validator in XHTML Transitional 1.0. However, after adding FPSS, we are getting a there is no attribute "onload" on Line 188:
    Code:
    <img id="fs-entry-img-1" class="fs-skip" alt=" " src="http://www.tebp.org/wp-content/themes/thesis_16/custom/images/posts/about2.jpg" onload="fsDoSlide()" />
    According to the author of the plugin, and to other articles and threads I have read about this issue, the error should not be occurring in Transitional mode, but the Validator is still choking on it. The "HTML Tidy" proposed version (which removes the onload command) does not work because the images inside the FPSS stop sliding by default (you have to click on the buttons for the slideshow to start sliding the pics).

    The slideshow is powered by jQuery and the whole layout of the FPSS is generated through php code, so here's the corresponding PHP code line just in case:
    Code:
    $fscontent .= '<img id="fs-entry-img-'.$id.'" class="fs-skip" alt=" " src="'.$entry['image'].'"';
    if ($id == $fslast) $fscontent .= ' onload="fsDoSlide()"'; // put this to make another loop after the last image
    $fscontent .= ' />';
    Any help on this will be greatly appreciated. Many thanks!

  2. #2
    Join Date
    May 2010
    Posts
    2
    I already figured this one out. The solution was suggested to me in a different forum. Basically, I just needed to wrap the JS script inside a <script> tag for it to work. Here's the code for those of you who land on this thread:

    HTML:
    Code:
    <img id="fs-entry-img-1" class="fs-skip" alt="" src="http://www.tebp.org/wp-content/themes/thesis_16/custom/images/posts/about2.jpg"/>
    <script type="text/javascript">
    document.images[document.images.length-1].onload = fsDoSlide
    </script>
    PHP:
    Code:
    $fscontent .= ' />';
    if ($id == $fslast) $fscontent .= ' <script type="text/javascript"> document.images[document.images.length-'.$id.'].onload = fsDoSlide </script>';
    Hope this helps!

Tags for this Thread

Posting Permissions

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