Foros del Web » Creando para Internet » HTML »

Problema al validar codigo

Estas en el tema de Problema al validar codigo en el foro de HTML en Foros del Web. Hola, tengo el siguiente codigo: Código PHP: < script language = "JavaScript"  type = "text/javascript" > <!-- var  navegador  =  navigator . appName ; if ( navegador  ...
  #1 (permalink)  
Antiguo 05/02/2007, 13:08
 
Fecha de Ingreso: enero-2007
Mensajes: 405
Antigüedad: 17 años, 3 meses
Puntos: 3
Problema al validar codigo

Hola, tengo el siguiente codigo:

Código PHP:
<script language="JavaScript" type="text/javascript">
<!--
var 
navegador navigator.appName;
if (
navegador == "Microsoft Internet Explorer"){
       
document.write("<style type='text/css' media='all'>@import 'ie.css'; </style>");
}else{
       
document.write('<style type="text/css" media="all">');
             
document.write('@import "otro.css";');
             
document.write('</style>');
}
                                    
//-->
</script> 
y me da los siguiente errores

Código:
1# Error  Line 9 column 83: end tag for element "STYLE" which is not open.

...media='all'>@import 'ie.css'; </style>");

The Validator found an end tag for the above element, but that element is 
not currently open. This is often caused by a leftover end tag from an element that was removed during editing, or by an implicitly closed element 
(if you have an error related to an element being used where it is not allowed, this is almost certainly the case). In the latter case this error will disappear as soon as you fix the original problem.

If this error occured in a script section of your document, you should 
probably read this FAQ entry.

✉
2# Error Line 13 column 27: end tag for element "STYLE" which is not open.

 document.write('</style>');
Dice que cierro la etiqueta sin haberla abierto, pero si esta abierta!!


Graciass
  #2 (permalink)  
Antiguo 07/02/2007, 01:13
Avatar de carlosmbrizuela  
Fecha de Ingreso: enero-2007
Ubicación: La Plata (Argentina)
Mensajes: 490
Antigüedad: 17 años, 3 meses
Puntos: 1
Re: Problema al validar codigo

document.write('@import "otro.css";');

tienes dos (;), deberia ser asi...
document.write('@import "otro.css"');
  #3 (permalink)  
Antiguo 08/02/2007, 05:58
 
Fecha de Ingreso: enero-2007
Mensajes: 405
Antigüedad: 17 años, 3 meses
Puntos: 3
Re: Problema al validar codigo

el problema estaba en </style>

Lo arregle poniendo <\/style>");

Me parecio raro pero valida bien ahora, jejeje

Saludos...
  #4 (permalink)  
Antiguo 08/02/2007, 06:36
Avatar de webosiris
Moderador egiptólogo
 
Fecha de Ingreso: febrero-2002
Ubicación: Luxor, Egipto
Mensajes: 10.725
Antigüedad: 22 años, 2 meses
Puntos: 998
Re: Problema al validar codigo

lo que si es que con ese js te estas complicando al vida... si quieres tener un css solo para IE, usa comentarios condicionales para IE
__________________
Pasamos tus PSD a HTML

Pobre del que lo sabe todo, porque no tiene nada más que aprender ni razón para vivir. -
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 09:52.