Ver Mensaje Individual
  #10 (permalink)  
Antiguo 18/12/2009, 17:05
Avatar de Panino5001
Panino5001
Me alejo de Omelas
 
Fecha de Ingreso: mayo-2004
Ubicación: -34.637167,-58.462984
Mensajes: 5.148
Antigüedad: 20 años
Puntos: 834
Respuesta: Error de sintaxis en css

Ah, ok, podés probar algo como esto (en valor1 o valor2 podés usar el valor que quieras, incluso el de retorno de tu función de obtención de cookie):
Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml">
<
head>
<
meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<
title>Documento sin t&iacute;tulo</title>
<
script>
function 
addCss(cssCode,i) {
    
control=document.getElementById(i)
    if(
control)
        
document.getElementsByTagName("head")[0].removeChild(control)
    var 
styleElement document.createElement("style");
    
styleElement.type "text/css";
    if (
styleElement.styleSheet) {
        
styleElement.styleSheet.cssText cssCode;
    } else {
        
styleElement.appendChild(document.createTextNode(cssCode))
    }
    
styleElement.id =i;
    
document.getElementsByTagName("head")[0].appendChild(styleElement);

</script>
</head>

<body>
<a class="menu" href="#">menu</a>
<script>
var valor1='#CCC',valor2='red';;

addCss('.menu{background-color:'+valor2+';}.menu:hover {background-color:'+valor1+';}','c')
</script>
</body>

</html>