Foros del Web » Creando para Internet » HTML »

Problema con iframes y W3C

Estas en el tema de Problema con iframes y W3C en el foro de HTML en Foros del Web. Hola a todos, Tengo un problema, el cual no se si está en el lugar correcto ya que involucra xHTML, CSS y PHP. Bueno el ...
  #1 (permalink)  
Antiguo 24/05/2009, 12:43
Avatar de murderer  
Fecha de Ingreso: marzo-2009
Ubicación: Argentina/Misiones/Iguazu/Localhost
Mensajes: 196
Antigüedad: 15 años, 1 mes
Puntos: 2
Problema con iframes y W3C

Hola a todos,

Tengo un problema, el cual no se si está en el lugar correcto ya que involucra xHTML, CSS y PHP.

Bueno el tema es que tengo un script en PHP para rotar banners, el problema es que cuando quiero ponerlo en un iframe, lo logro poner, pero lo verifico con el validador de W3C me tira errores, diciendo que no se pueden poner atributos como "height", etc. Lo que quisiera saber es cómo se puede modificar esto, para que no te tire errores en el validador. Se, por experiencia, que en las imagenes uno puede convertirlo en un estilo y así evitar los errores, pero por lo visto no se puede realizar lo mismo con los iframes.

Desde ya muchas gracias,

Murderer
  #2 (permalink)  
Antiguo 24/05/2009, 15:14
Avatar de jomaruro
Colaborador
 
Fecha de Ingreso: junio-2002
Ubicación: Naboo
Mensajes: 5.442
Antigüedad: 21 años, 9 meses
Puntos: 361
Respuesta: Problema con iframes y W3C

Hola:

No suelo usar iframes pero me imagino que esos atributos los estarás poniendo dentro de la etiqueta correspondientes sin style, por eso te da error.

Me explico, por ejemplo:

Código:
< img src="imagen.jpg" height="100px">
eso te daría error

deberías ponerlo en una hoja de estilos, dentro del <style> en el <head> o dentro del la propia etiqueta:

Código:
<img src="imagen.jpg" style="height:100px;">
Saludos.

  #3 (permalink)  
Antiguo 24/05/2009, 19:05
Avatar de deirdre  
Fecha de Ingreso: mayo-2009
Mensajes: 690
Antigüedad: 14 años, 11 meses
Puntos: 45
Respuesta: Problema con iframes y W3C

Si viéramos tu código completo sería mucho mejor para poder ayudar.
  #4 (permalink)  
Antiguo 25/05/2009, 14:44
Avatar de murderer  
Fecha de Ingreso: marzo-2009
Ubicación: Argentina/Misiones/Iguazu/Localhost
Mensajes: 196
Antigüedad: 15 años, 1 mes
Puntos: 2
Respuesta: Problema con iframes y W3C

Cita:
Iniciado por jomaruro Ver Mensaje
Hola:

No suelo usar iframes pero me imagino que esos atributos los estarás poniendo dentro de la etiqueta correspondientes sin style, por eso te da error.

Me explico, por ejemplo:

Código:
< img src="imagen.jpg" height="100px">
eso te daría error

deberías ponerlo en una hoja de estilos, dentro del <style> en el <head> o dentro del la propia etiqueta:

Código:
<img src="imagen.jpg" style="height:100px;">
Saludos.

Hola jomaruro, antes que nada gracias por tu respuesta.

He intentado eso pero me sigue tirando errores en el validador

deirdre, y jomaruro

El codigo que usé fué este:
Código:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin t&iacute;tulo</title>
</head>

<body>
<iframe src="/counter-strike/index.html" style="height:100px; width:100px"></iframe>
</body>
</html>
Agrege el encabezado de W3 sólo que no lo puedo poner por spam ¬¬

Buenos desde ya muchas gracias a todos
  #5 (permalink)  
Antiguo 25/05/2009, 15:15
Colaborador
 
Fecha de Ingreso: junio-2007
Mensajes: 5.798
Antigüedad: 16 años, 10 meses
Puntos: 539
Respuesta: Problema con iframes y W3C

El error te lo marca porque estarás usando un doctype "Strict" como:
Código html:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

Sin embargo, si cambias el doctype a "transitional":
Código html:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
el código que has puesto valida correctamente.

En el primer caso (con strict), el motivo de los tres errores te lo dice el propio http://validator.w3.org/check y están relacionados con el tipo de documento que declaras:
Cita:
Attribute "src" exists, but can not be used for this element.

<iframe src="/counter-strike/index.html" style="height:100px; width:100px"></ifr

You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).
Cita:
Attribute "style" exists, but can not be used for this element.

<iframe src="/counter-strike/index.html" style="height:100px; width:100px"></iframe>

You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).

Y el tercero:
Cita:
element "iframe" undefined. Did you mean "iframe" or "frame"?

…x.html" style="height:100px; width:100px"></iframe>

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:
* 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),


P.D.: Jomaruro, la etiqueta img también se debe cerrar:
Código html:
Ver original
  1. <img src="... />

Un saludo
__________________
Por una web con mucho estilo
+++ CUENTA ABANDONADA. ¿la quieres? +++
  #6 (permalink)  
Antiguo 25/05/2009, 15:31
Avatar de jomaruro
Colaborador
 
Fecha de Ingreso: junio-2002
Ubicación: Naboo
Mensajes: 5.442
Antigüedad: 21 años, 9 meses
Puntos: 361
Respuesta: Problema con iframes y W3C

Hola:

Cita:
Iniciado por kseso? Ver Mensaje
P.D.: Jomaruro, la etiqueta img también se debe cerrar:


Lo sé kseso?, fue un despiste tonto. Gracias.

Saludos.

  #7 (permalink)  
Antiguo 31/05/2009, 12:40
Avatar de murderer  
Fecha de Ingreso: marzo-2009
Ubicación: Argentina/Misiones/Iguazu/Localhost
Mensajes: 196
Antigüedad: 15 años, 1 mes
Puntos: 2
Respuesta: Problema con iframes y W3C

Hola Kseso?,

Me fije lo que pusiste, pero con resultados .

Los errores que ahora tiran son:


-----1-------

# Error Line 7, Column 13: Attribute "src" exists, but can not be used for this element.

<iframe src="/counter-strike/index.html" style="height:100px; width:100px"></ifr

You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).

-----2--------

Line 7, Column 48: Attribute "style" exists, but can not be used for this element.

<iframe src="/counter-strike/index.html" style="height:100px; width:100px"></iframe>

-------3-------

Line 7, Column 75: element "iframe" undefined. Did you mean "iframe" or "frame"?

…x.html" style="height:100px; width:100px"></iframe>

Nota: uso HTML 1.1


Por si las dudas, no hay otra alternativa de rotar banners que no sea con iframes?

Desde ya muchas gracias,

Saludos!

Murderer
  #8 (permalink)  
Antiguo 31/05/2009, 13:14
Avatar de hades87  
Fecha de Ingreso: diciembre-2007
Ubicación: Barcelona - España
Mensajes: 3.194
Antigüedad: 16 años, 4 meses
Puntos: 68
Respuesta: Problema con iframes y W3C

Puedes probar poniendo este:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
__________________
No diseñes usando tablas.
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:15.