PDA

View Full Version : Ultimate Fade-in Slideshow -- Validation Errors



ellenjones6
09-03-2012, 07:16 PM
1) Script Title: Ultimate Fade-in Slideshow (V2.4)

2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...nslideshow.htm (http://www.dynamicdrive.com/dynamici...nslideshow.htmhttp://)

3) Describe problem: I am getting three validation errors on the slide show page. The page without the slide show validates fine (http://validator.w3.org/check?uri=http%3A%2F%2Fadirondackvic.org%2FArt-at-the-Paul-Smiths-VIC-15-October-2012.html&charset=%28detect+automatically%29&doctype=Inline&group=0).

However, the page with the slide show gives me three scary validation errors (http://validator.w3.org/check?uri=http%3A%2F%2Fadirondackvic.org%2FWoods-and-Waters-Trail.html&charset=%28detect+automatically%29&doctype=Inline&group=0&ss=1&outline=1&No200=1&verbose=1)

The validator is complaining about something in the JavaScript.

Here is the URL of the page with validation errors: http://adirondackvic.org/Woods-and-Waters-Trail.html

Here is the text of the first error, which seems to be causing the subsequent two errors:


Error Line 62, Column 23: document type does not allow element "STYLE" here

<style type="text/css">

The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).

One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).

The nice validator sent me to a page explaining why I got the error, but I still have no clue how to fix it. I searched the forum for this issue and found a few threads that addressed it, but I remain clueless. I am afraid to mess with the code because (thanks to your help) it now works like it is supposed to. What am I doing wrong? Sorry to be such a bother... ellen

jscheuer1
09-03-2012, 08:46 PM
If you remove:


<noscript>
<style type="text/css">
#fadeshow2 {
overflow: auto;
width: 488px;

}
#fadeshow2 img {
display: block;

}
#fadeshow2toggler * {
display: none;

}
#fadeshow2toggler .noscript {
display: inline;
}

</style>
</noscript>

Then everything is OK, so the only real 'error' is having a style section in a noscript section. This is now allowed in HTML 5, so no browser is going to have a problem with it. You can either just live with it, or change to an HTML 5 DOCTYPE. If you do the latter though there will be 10 correctable errors due to non-conformance to the HTML 5 standard. These are mostly the use of deprecated attributes. The one that might be tricky to fix is that the HTML 5 validator incorrectly interprets characters inside javascript multi line comments. That doesn't need to be fixed, but to avoid it, change this:


<script type="text/javascript" src="fadeslideshow.js">

/***********************************************
* Ultimate Fade In Slideshow v2.0- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more
***********************************************/
</script>

to:


<script type="text/javascript" src="fadeslideshow.js">

/***********************************************
//* Ultimate Fade In Slideshow v2.0- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
//* This notice MUST stay intact for legal use
//* Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more
***********************************************/
</script>

The other 9 errors can be fixed by using style instead of attributes.

Or as I say, you could just leave everything the way it is. In its current form the page will not cause any problems in browsers.