Ya tengo la página de usuario y la de login, pero sucede que al entrar el usuario, no hace los cambios guardados desde la última vez que entró a dicha página (como la fuente y la imagen de fondo).
Aquí les muestro lo que tengo hecho, no encuentro cómo hacerle. Gracias de antemano. Saludos.
Código Javascript
:
Ver original<html>
<head>
<script language="javascript">
function login()
{
dom_us=document.getElementById('usuario');
dom_password=document.getElementById('contraseña');
document.cookie=dom_us.value+'='+dom_password.value;
document.cookie="usuario_activo"+"="+dom_us.value;
alert(document.cookie);
window.location="select_func_cookies.html";
}
</script>
</head>
<body bgcolor="#3399CC">
<form name="formulario" action="">
<label for="usuario">Usuario</label>
<input type="text" id="usuario">
<br><br>
<label for="contraseña">Contraseña</label>
<input type="password" id="contraseña">
<input type="button" name="boton" value="Entrar" onclick="login()">
</form>
</body>
</html>
La otra página:
Código Javascript
:
Ver original<html>
<head>
<script language="javascript">
function cambiar()
{
dom_select=document.getElementsByTagName('select')[1];
if(dom_select.selectedIndex==0)
{dom_img=document.getElementsByTagName('body')[0];
dom_img.setAttribute('background','Sasuke.jpg');
valor_cookie="Sasuke.jpg";}
if(dom_select.selectedIndex==1)
{dom_img=document.getElementsByTagName('body')[0];
dom_img.setAttribute('background','Neji.jpg');
valor_cookie="Neji.jpg";}
dom_select2=document.getElementsByTagName('select')[0];
if(dom_select2.selectedIndex==0)
{dom_f=document.getElementsByTagName('font')[0];
dom_f.setAttribute('face','Arial');
valor_cookie=valor_cookie+'/Arial';}
if(dom_select2.selectedIndex==1)
{dom_f=document.getElementsByTagName('font')[0];
dom_f.setAttribute('face','Book Antiqua');
valor_cookie=valor_cookie+'/Book Antiqua';}
if(dom_select2.selectedIndex==2)
{dom_f=document.getElementsByTagName('font')[0];
dom_f.setAttribute('face','Century Gothic');
valor_cookie=valor_cookie+'/Century Gothic';}
document.cookie='cookie1'+'='+valor_cookie;//valor_cookie+Arial, ejemplo de cómo guardarla con más valores
alert(document.cookie);
}
function after_login()
{
cookies_almacenadas=document.cookie.split(";");
for(var x=0;x<cookies_almacenadas.length;x++)
{
cookie_buscada=cookies_almacenadas[x].split("=");
if(cookie_buscada[0]=='usuario_activo')
{}
}
}
</script>
</head>
<body bgcolor="black">
<select name="lista_f">
<option value="Arial">Arial</option>
<option value="Book Antiqua">Book Antiqua</option>
<option value="Century Gothic">Century Gothic</option>
</select>
<select name="lista_img">
<option value="Sasuke">Sasuke</option>
<option value="Neji">Neji</option>
</select>
<input type="button" name="boton" value="Cambiar" onclick="cambiar()">
<br>
<p align="center">
<font size=4 color="white">Yatzil Reyes Morales. ISC - 301. Programación II. Universidad Jean Piaget.</font>
</p>
</body>
</html>