jeg forstår ikke at den ikke vil slette når er ikke er sat hak
Hej expjeg forstår ikke hvorfor den ikke sletter cookies hvis folk lade være med at sætte hak
<script language="javascript" type="text/javascript">
function skrivCookie(name,value,expTime,path){//Tid i dage
switch(skrivCookie.arguments.length){
case 1:
var expTime = 0;
var path = "/";
case 2:
var expTime = 0;
var path = "/";
case 3:
var path = "/";
}
var exp = new Date().getTime()+expTime*24*60*60*1000;
exp = new Date(exp).toGMTString();
var cook = name + " = " + escape(value) + ";expires=" + exp + ";path=" + path;
document.cookie = cook;
}
function hentCookie(name){
if (document.cookie){
var n = document.cookie.indexOf(name+"=");
if (n>-1){
var val = document.cookie.substring(n+name.length+1);
n = val.indexOf(";");
if(n>-1)val=val.substring(0,n);
return unescape(val);
}
}
}
function hentLogin(){
f = document.logind;
cook = hentCookie('login');
if(cook==undefined||cook=="")return;
cook = cook.split('#');
f.chat_navn.value = cook[0];
f.password.value = cook[1];
}
</script>
</head>
<body onload="hentLogin();">
<form name="logind" method="POST" action="" onsubmit="if(this.husklogin.checked)skrivCookie('login',this.chat_navn.value+'#'+this.password.value,1);">
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">
<tr>
<td width="12%">Chat_navn:</td>
<td width="88%"><input type="text" name="chat_navn" size="20"></td>
</tr>
<tr>
<td width="12%">Password</td>
<td width="88%"><input type="text" name="password" size="20"></td>
</tr>
<tr>
<td width="12%">husklogin</td>
<td width="88%"><input type="checkbox" name="husklogin" value="ON">husk
login</td>
</tr>
<tr>
<td width="12%">
<p align="right"><input type="submit" value="Send" name="B1"></td>
<td width="88%"><input type="reset" value="Nulstil" name="B2"></td>
</tr>
</table>
</form>
</body>
