Foros del Web » Creando para Internet » HTML »

Problema validación XHTML 1.0 Transitional de un script

Estas en el tema de Problema validación XHTML 1.0 Transitional de un script en el foro de HTML en Foros del Web. Hola, alguien conoce alguna manera de que el siguiente script pase la validación XHTML 1.0 Transitional y siga funcionando ; ) Código: <script type="text/javascript"> function ...
  #1 (permalink)  
Antiguo 07/03/2007, 06:17
 
Fecha de Ingreso: mayo-2005
Mensajes: 16
Antigüedad: 18 años, 11 meses
Puntos: 0
Problema validación XHTML 1.0 Transitional de un script

Hola, alguien conoce alguna manera de que el siguiente script pase la validación XHTML 1.0 Transitional y siga funcionando ; )

Código:
<script type="text/javascript">
function writeIframe() {
var s = location.search.substring(1);
var src = s.length?s:"home.html";
document.write('<iframe src="'+src+'" name="ventana" width="574" height="377" scrolling="no" frameborder="0" id="ventana"></iframe>');
}
</script>
Me da el error siguiente:

Error Line 69 column 121: document type does not allow element "iframe" here.
...ing="no" frameborder="0" id="ventana"></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).

Muchas gracias a todos
  #2 (permalink)  
Antiguo 07/03/2007, 06:26
Avatar de JavierB
Colaborador
 
Fecha de Ingreso: febrero-2002
Ubicación: Madrid
Mensajes: 25.052
Antigüedad: 22 años, 2 meses
Puntos: 772
Re: Problema validación XHTML 1.0 Transitional de un script

Hola Goser

Código:
<script type="text/javascript">
<!--
// tu código
-->
</script>
Saludos,
  #3 (permalink)  
Antiguo 07/03/2007, 10:34
 
Fecha de Ingreso: mayo-2005
Mensajes: 16
Antigüedad: 18 años, 11 meses
Puntos: 0
Re: Problema validación XHTML 1.0 Transitional de un script

Gracias JavierB

Funciona perfectamente

Saludos

Goser
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 17:09.