Skip navigation
Currently Being Moderated

When using CS5.5 dreamweaver "rollover image" tool it is not complying with W3C validation. Why?

Mar 21, 2012 11:16 AM

When using CS5.5 dreamweaver "rollover image" tool it is not complying with W3C validation. Why?  It is erroring out all over the place?

 

Any help please that would be great!!!

 

Thanks,

 

TIffany

 
Replies
  • Currently Being Moderated
    Mar 21, 2012 11:25 AM   in reply to CutieRomano

    Please post a link to your website so we can see the code and the output from the W3C Validator.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 21, 2012 12:17 PM   in reply to CutieRomano

    Have you used a DocType in your page?

     

    Just a thought

     

    Martin

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 21, 2012 12:32 PM   in reply to CutieRomano

    I'm guessing here because I don't have access to your entire code.

     

    X/HTML docs (transitional) treat JavaScript as CDATA (character data).  W3C Validator ignores character data.

     

    XHTML strict treats JavaScript as PCDATA (parsed character data).  W3C Validator chokes on this and flags it as invalid code.

     

    To avoid errors in XHTML Strict, add CDATA tags around your JavaScript code.  Or, simply change doc type to XHTML transitional.

     

     

    Nancy O.

    Alt-Web Design & Publishing

    Web | Graphics | Print | Media  Specialists 

    http://alt-web.com/

    http://twitter.com/altweb

    http://alt-web.blogspot.com/

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 9, 2012 5:04 AM   in reply to Nancy O.

    Hello Nancy,

     

    I have the same problem on my website (no validation for the image rollovers made in DW). Example page: http://www.opsicilie.nl/NL/home2.html

     

    Validator: http://validator.w3.org/check?uri=http%3A%2F%2Fwww.opsicilie.nl%2FNL%2 Fhome2.html&charset=%28detect+automatically%29&doctype=Inline&group=0& user-agent=W3C_Validator%2F1.3

     

    I've tried using the CDATA tags I found on W3 but I couldn't use them without getting syntax errors in DW. Your other solution was "Or, simply change doc type to XHTML transitional." It looks like it's already XHTML transitional:

     

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">

     

    Could you tell me what I should change on the page the pass the validation? 

     

    Thank you in advance for your time!

     

    Martin

     

    PS bonus question: is this the correct way of inserting the language tag (language is Dutch) on this page?:

    <html xmlns="http://www.w3.org/1999/xhtml" lang="nl" xml:lang="nl">

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 4, 2013 3:31 PM   in reply to rigte056

    Try this...

    Add this... <!--    //-->  to your code after the script type, and before end script.

     

    <script type="text/javascript">

    <!--

    The rollover code here

    //-->

    </script>

     

    Bill

    http://www.4imagedesign.com/

     

    Let me know if this worked for you.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 4, 2013 3:41 PM   in reply to John Waller

    Try this...

    Add this... <!--    //-->  to your code after the script type, and before end script.

     

    <script type="text/javascript">

    <!--

    The rollover code here

    //-->

    </script>

     

    Bill

    http://www.4imagedesign.com/

     

    Let me know if this worked for you.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 19, 2013 12:15 PM   in reply to 4imagedesign

    I am having the exact same problem with DW js rollover script not passing W3C validation (lots and lots of errors).

     

    My page is <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

     

    Commenting out the script as you suggested did not work at all (for me).

     

    Any other suggestions anyone?

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 19, 2013 12:24 PM   in reply to IdRatherBeInOregon

    Don't worry about MM_rollover scripts. You can safely ignore those warnings because W3C's HTML validation tool can't distinguish JavaScript from HTML so it reports errors.    Move on to more important things.

     

     

    Nancy O.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 19, 2013 12:26 PM   in reply to IdRatherBeInOregon

    Make sure you implement the CDATA "tag" correctly...

     

    <script>

    //<![CDATA[

        all-javascript-here

    //]]>

    </script>

     

    The above ALWAYS worked for my xhtml pages that threw  errors from DW behaviors (it's the only reason I saved that particular Snippet).

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 19, 2013 12:53 PM   in reply to IdRatherBeInOregon

    I noticed the same thing last year. The only difference was that I had upgraded to cs6. So I had some old code produced with dw cs3, and the newer with cs6. I was using the same functions, the same way, but was getting tons of validation errors now. So I compared the new code to the old, and found the commenting had been removed on the cs6 version.

    I added it back, and thus perfect validation. I built this site earlier this year using java rollovers with dw cs6 and it validates perfectly.

     

    http://www.kmnr1.com lines 41 - 64 on index page

     

    But these days, I try to refrain from using java rollovers when ever possible. css rollovers do the trick

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 19, 2013 1:11 PM   in reply to Jon Fritz II

    THANK YOU!!!

     

    The CDATA worked!

     

    Thank you very, very much!

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 19, 2013 1:14 PM   in reply to 4imagedesign

    Thank you for your feedback, but I'm not going to be updating to v6 in the near future. I did try commenting out the script but that didn't work.

     

    Another poster suggested adding CDATA tags and they did work.

     

    But thank you again for your response!

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points