Page 1 sur 1

Javascript et norme w3c

Posté : 27 mai 2005, 15:20
par hormia
Bonjour,

je suis en train de passer mon site à la norme w3c. J'ai quasiment tout réussit à l'exception de page .php qui génère du javascript à partir de la base de donnée. (sinon j'aurai mis le javascript dans un .js)

Voilà le genre d'erreur que j'ai , ca vient des document.write() et des balises html qu'il y a dedans. Je ne sais pas comment faire :

Code : Tout sélectionner

Line 210, column 48: document type does not allow element "div" here ...v style="position:relative;height:22"><div class="popper" id="topdeck"></div. 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). ✉ Line 366, column 166: character data is not allowed here ...="0" cellpadding="0" cellspacing="0">'; You have used character data somewhere it is not permitted to appear. Mistakes that can cause this error include putting text directly in the body of the document without wrapping it in a container element (such as a <p>aragraph</p>) or forgetting to quote an attribute value (where characters such as "%" and "/" are common, but cannot appear without surrounding quotes). ✉ Line 370, column 63: character data is not allowed here ...+='<tr><td style="height:20px">'+msg[pass]+'</td></tr>'; ✉ Line 386, column 119: character data is not allowed here ..."0" style="height:15px; width:110px">');

Merci de votre aide

Posté : 27 mai 2005, 15:40
par Cyrano
Norme HTML ou XHTML ?

Posté : 27 mai 2005, 15:42
par hormia
XHTML, malgrès que j'ai plein d'erreur d'affichage avec, mais jessayerai de faire en sorte que celà s'affiche bien :

http://asso-e2rh.nuxit.net/index2.php

Posté : 27 mai 2005, 17:10
par Cyrano
Je me demande si tu m'as mis le bon lien, parce que j'ai un code source en HTML 4.01 transitional et pas les mêmes erreurs...

Posté : 30 mai 2005, 09:36
par hormia
C'est parce que mon affichade déconné avec un doctype xhtml. (le menu déroulant en haut à droite).

Là j'ai remis un doctype xhtml.

Posté : 22 juin 2005, 17:55
par DjMerguez
Essaie de mettre le javascript dans un CDATA :

Code : Tout sélectionner

<script type="text/javascript"> //<![CDATA[ for(i = 0; i < nCount; ++i) { // Fait des trucs... } //]]> </script>