Jump to content
Fórum Script Brasil
  • 0

Problema com validação W3C


R_MontSerrat

Question

Boa tarde, pessoal.

Tenho uma função javascript que chama um iframe no InnerHtml de uma div, funciona normalmente mas quando passo no validador W3C, ele não aceita

já fiz de tudo e não consigo solucionar

aqui está o código

function clica_informatica(){
        document.getElementById("principal").className="informatica";
        document.getElementById("principal").innerHTML="<iframe src='informatica' height='710' frameborder='0' width='1024' scrolling='no'></iframe>" 
}

E aqui é o erro:

Line 43, Column 132: document type does not allow element "iframe" here

…etronicos' height='710' frameborder='0' width='1024' scrolling='no'></iframe>"

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).

Alguém tem como me ajudar?

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Pelo que eu vi é erro de sintax, tenta substituir por este:

function clica_informatica(){
        document.getElementById("principal").className="informatica";
        document.getElementById("principal").innerHTML="<iframe src='/informatica' height='710' frameborder='0' width='1024' scrolling='no'></iframe>";
}

Abraços. \o

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152k
    • Total Posts
      651.5k
×
×
  • Create New...