XHTML Validation problem.

Posted:
in Genius Bar edited January 2014
When validating a page, i get this error:

Code:


Line 12, column 17: there is no attribute "language" (explain...).

<script language="JavaScript" type="text/JavaScript">







This is the XHTML in question:

Code:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">;

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



(I Deleted some of the code here...just tile and meta stuff, nothing that pertains to this question.)



<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<!-- InstanceBeginEditable name="head" -->

<script language="JavaScript" type="text/JavaScript">

<!--

function MM_openBrWindow(theURL,winName,features) { //v2.0

window.open(theURL,winName,features);

}

//-->

</script>







I don't understand what the problem is, I've never had it have a problem here before, any one have any ideas?



Thanks in advance.

Comments

  • Reply 1 of 4
    ringoringo Posts: 329member
    Easy, "language" is no longer a valid attribute for the "script" tag. Click on the "Explain..." link. It should tell you why.



    I'm happy to see people using XHTML, and I'm amazed to see you're using strict. Impressive.
  • Reply 2 of 4
    Quote:

    Originally posted by Stroszek



    I don't understand what the problem is, I've never had it have a problem here before, any one have any ideas?



    Thanks in advance.




    Well, that's easy. Your document is XHTML 1.0 Strict. The "language attribute is not allowed inside of the script element in XHTML 1.0 Strict. If you want it to work, use XHTML 1.0 Transitional. If you really want to write strict XHTML, go re-read the spec...
  • Reply 3 of 4
    stroszekstroszek Posts: 801member
    So I just cut the language part out?

    Any one know why they changed this?
  • Reply 4 of 4
    gargoylegargoyle Posts: 660member
    4.8. Script and Style elements





    Taken from this page:- http://www.w3.org/TR/xhtml1/#normative





    Quote:

    In XHTML, the script and style elements are declared as having #PCDATA content. As a result, < and & will be treated as the start of markup, and entities such as &lt; and &amp; will be recognized as entity references by the XML processor to < and & respectively. Wrapping the content of the script or style element within a CDATA marked section avoids the expansion of these entities.



    <script type="text/javascript">

    <![CDATA[

    ... unescaped script content ...

    ]]>

    </script>



    CDATA sections are recognized by the XML processor and appear as nodes in the Document Object Model, see Section 1.3 of the DOM Level 1 Recommendation [DOM].



    An alternative is to use external script and style documents.



Sign In or Register to comment.