Foros del Web » Creando para Internet » Diseño web »

Script no me valida en w3c

Estas en el tema de Script no me valida en w3c en el foro de Diseño web en Foros del Web. hola, tengo un rotador de imagenes y me da error cuando la pinto, porque no puedo poner un tag segun la w3c dentro de javascrit ...
  #1 (permalink)  
Antiguo 07/07/2009, 14:32
Avatar de kaninox  
Fecha de Ingreso: septiembre-2005
Ubicación: In my House
Mensajes: 3.597
Antigüedad: 18 años, 7 meses
Puntos: 49
Script no me valida en w3c

hola, tengo un rotador de imagenes y me da error cuando la pinto, porque no puedo poner un tag segun la w3c dentro de javascrit alguna sugerencia....

Código javascript:
Ver original
  1. <script language="JavaScript" type="text/javascript">
  2.  
  3. banners= new Array();
  4. banners[0]="img_al/image1.png";
  5. banners[1]="img_al/image2.png";
  6. banners[2]="img_al/image3.png";
  7. banners[3]="img_al/image4.png";
  8. banners[4]="img_al/image5.png";
  9. banners[5]="img_al/image6.png";
  10. banners[6]="img_al/image7.png";
  11. banners[7]="img_al/image8.png";
  12. banners[8]="img_al/image9.png";
  13. banners[9]="img_al/image10.png";
  14. banners[10]="img_al/image11.png";
  15. banners[11]="img_al/image12.png";
  16.  
  17. totalbanners = banners.length;
  18. var ahora = new Date()
  19. var segundos = ahora.getSeconds()
  20. var ad = segundos % totalbanners;
  21. seleccionado=banners[ad];
  22. localizador=seleccionado.lastIndexOf('.');
  23. localizador2=localizador+4
  24. extension=seleccionado.substring(localizador+1,localizador2);
  25. archivo=seleccionado.substring(0,localizador);
  26.  
  27.  
  28. document.write('<img src='+seleccionado+' width="280" height="498" title="mititulo" alt="nodisponible" />');
  29.  
  30. // Fin
  31. // Fin
  32. </script>

me dice :

Código:
…80" height="498" title="mititulo" alt="nodisponible" />');

✉

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).
__________________
Gokuh Salvo al mundo. PUNTO!!!!
  #2 (permalink)  
Antiguo 07/07/2009, 14:35
Avatar de David
Moderador
 
Fecha de Ingreso: abril-2005
Ubicación: In this planet
Mensajes: 15.720
Antigüedad: 19 años
Puntos: 839
Respuesta: Script no me valida en w3c

En lo posible, siempre coloca el código Javascript en un archivo separado (.js)

O comentar el código:
Código javascript:
Ver original
  1. <script type="text/javascript">
  2. <!--
  3.     alert("Code");
  4. -->
  5. </script>
__________________
Por favor, antes de preguntar, revisa la Guía para realizar preguntas.
  #3 (permalink)  
Antiguo 07/07/2009, 15:19
Avatar de kaninox  
Fecha de Ingreso: septiembre-2005
Ubicación: In my House
Mensajes: 3.597
Antigüedad: 18 años, 7 meses
Puntos: 49
Respuesta: Script no me valida en w3c

no se me había ocurrido con esto :P llevas toda la razón
saludos
__________________
Gokuh Salvo al mundo. PUNTO!!!!
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 18:14.