Ver Mensaje Individual
  #1 (permalink)  
Antiguo 07/03/2008, 18:01
jortiz015
 
Fecha de Ingreso: marzo-2008
Mensajes: 5
Antigüedad: 16 años, 1 mes
Puntos: 0
Pregunta validar javascript con el w3c

Hoola a todos, acabo de subscribirme a este foro y quiero pedir perdon por si no lo estoy haciendo bien, no me ha quedado muy claro si debía abrir un tema nuevo para mi pregunta o si seguir alguno de los aviertos.s.
Os Cuento, estoy intentando valaidar un javascript en el w3c y me da un error que no entiendo, a ver si me podeis hechar una manita.
El código del javascript es:

<script type="text/javascript" language="JavaScript">
var dt = new Date();
var hr = dt.getHours();
var msg = ((hr<12) ? "Buenos dias" :"Buenas Noches");
msg = ((hr>11)&&(hr<19) ? "Buenas Tardes" : msg);
msg=" <H2> "+msg+" !</H2>";
document.write(msg);
</script>

y el error del validador del w3c es:


Validation Output: 5 Errors
lista de 9 elementos
Warning
Line 38, Column 15: character "<" is the first character of a delimiter but occurred as data. var msg = ((hr <12) ? "Buenos dias" :"Buenas Noches");

This message may appear in several cases:
lista de 3 elementos nivel de encabezado 1
• You tried to include the "<" character in your page: you should escape it as "lt;"
• You used an unescaped ampersand "": this may be valid in some contexts, but it is recommended to use "amp;", which is always safe.
• Another possibility is that you forgot to close quotes in a previous tag.
final de lista nivel de encabezado 1
Warning
Line 39, Column 15: character "" is the first character of a delimiter but occurred as data. msg = ((hr>11) &(hr<19) ? "Buenas Tardes" : msg);

This message may appear in several cases:
lista de 3 elementos nivel de encabezado 1
• You tried to include the "<" character in your page: you should escape it as "lt;"
• You used an unescaped ampersand "": this may be valid in some contexts, but it is recommended to use "amp;", which is always safe.
• Another possibility is that you forgot to close quotes in a previous tag.
final de lista nivel de encabezado 1
Warning
Line 39, Column 16: character "" is the first character of a delimiter but occurred as data. msg = ((hr>11)& &(hr<19) ? "Buenas Tardes" : msg);

This message may appear in several cases:
lista de 3 elementos nivel de encabezado 1
• You tried to include the "<" character in your page: you should escape it as "lt;"
• You used an unescaped ampersand "": this may be valid in some contexts, but it is recommended to use "amp;", which is always safe.
• Another possibility is that you forgot to close quotes in a previous tag.
final de lista nivel de encabezado 1
Warning
Line 39, Column 20: character "<" is the first character of a delimiter but occurred as data. msg = ((hr>11)&(hr <19) ? "Buenas Tardes" : msg);

This message may appear in several cases:
lista de 3 elementos nivel de encabezado 1
• You tried to include the "<" character in your page: you should escape it as "lt;"
• You used an unescaped ampersand "": this may be valid in some contexts, but it is recommended to use "amp;", which is always safe.
• Another possibility is that you forgot to close quotes in a previous tag.
final de lista nivel de encabezado 1
Error
Line 40, Column 10: element "H2" undefined. msg=" <H2 > "+msg+" !</H2>";

You have used the element named above in your document, but the document type you are using does not define an element of that name.
This error is often caused by:
lista de 3 elementos nivel de encabezado 1
• incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Frameset" document type to get the
"<frameset>" element),
• by using vendor proprietary extensions such as "<spacer>" or "<marquee>" (this is usually fixed by using CSS to achieve the desired effect
instead).
• by using upper-case tags in XHTML (in XHTML attributes and elements must be all lower-case).
final de lista nivel de encabezado 1
Error
Line 38, Column 16: XML Parsing Error: StartTag: invalid element name. var msg = ((hr< 12) ? "Buenos dias" :"Buenas Noches");

Error
Line 39, Column 16: XML Parsing Error: xmlParseEntityRef: no name. msg = ((hr>11)& &(hr<19) ? "Buenas Tardes" : msg);

Error
Line 39, Column 17: XML Parsing Error: xmlParseEntityRef: no name. msg = ((hr>11)& (hr<19) ? "Buenas Tardes" : msg);

Error
Line 39, Column 21: XML Parsing Error: StartTag: invalid element name. msg = ((hr>11)&(hr< 19) ? "Buenas Tardes" : msg);

final de lista

Muchas gracias a quien me pueda ayudar.