Ver Mensaje Individual
  #10 (permalink)  
Antiguo 26/08/2005, 00:13
Avatar de tunait
tunait
Moderadora
 
Fecha de Ingreso: agosto-2001
Ubicación: Terok Nor
Mensajes: 16.805
Antigüedad: 23 años, 5 meses
Puntos: 381
ok, yá veo lo que ha pasado, puse una condición al revés

Código:
function setActiveStyleSheet(title) {
	var i, a, main;
	for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
		if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
			a.disabled = true;
		if(a.getAttribute("title") == title) a.disabled = false;
		}
	}
	document.cookie = 'estiloCSS=' + title; //aquí ponemos la cookie
}
//y aquí verificamos si la cookie existe 
var galleta = document.cookie;
galleta = galleta.split(';');
estiloCSS = '';
for(m=0; m<galleta.length; m++){
	if(galleta[m].split('=')[0] == 'estiloCSS'){
		estiloCSS = galleta[m].split('=')[1];
		break;
	}
}

//en caso de existir la cookie llama a la función que cambia la hoja de estilos

if(estiloCSS != ''){
	setActiveStyleSheet(estiloCSS)
}
en esta última condición lo puse así

if(estiloCSS == '')

...y tenía que estar así

if(estiloCSS != '')

funciona ok, al final monté el tinglado. Te dejé un ejemplo en marcha

www.tunait.com/pruebas/flashera/

yá me contarás

un saludo