开发者

Tried to validate my page, I have an error on my <script> tag, missing attribute?

开发者 https://www.devze.com 2023-01-14 12:53 出处:网络
Line 207, Column 50: Required attributes missing on element script. <script type=\"text/javascript\" charset=\"utf-8\">
Line 207, Column 50: Required attributes missing on element script.

   <script type="text/javascript" charset="utf-8">

Element-specific attributes for element script:
    Global attributes
    src
    async
    defer
    type
    charset 

What is it that I am missing? Than开发者_运维问答kyou

Edit: This is for all of my handwritten code, I don't want it connecting to an external js file


Seams legit. Maybe something to do with what you have inside the <script>?

Content model:
If there is no src attribute, depends on the value of the type attribute, but must match script content restrictions.


See this piece of the XHTML strict DTD

<!ELEMENT script (#PCDATA)>
<!ATTLIST script
  id          ID             #IMPLIED
  charset     %Charset;      #IMPLIED
  type        %ContentType;  #REQUIRED
  src         %URI;          #IMPLIED
  defer       (defer)        #IMPLIED
  xml:space   (preserve)     #FIXED 'preserve'
  >

The only required attribute is type. The problem lies in another part of your code, please paste it here.


works fine for me.. This document was successfully checked as HTML 4.0 Transitional!


To fix it all I had to do was remove the charset attribute. :)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号