记住登录状态问题
老师:以下代码记不了登录状态,请问如何修改!感谢!
<script language=javascript>
function checkform() {
if (frm.IfSave.checked){
saveCookie("InfoUserName", frm.username.value, 365);
saveCookie("InfoUserPWD", frm.password.value, 365);
saveCookie("InfoIfSave", 1, 365);
}else {
deleteCookie("InfoUserName")
deleteCookie("InfoUserPWD")
deleteCookie("InfoIfSave")
}
return true;
}
</script>
<form action="index.asp?action=login" method="post" name="loginform">
<TABLE style="MARGIN-TOP: 20px" cellSpacing=0 cellPadding=0 width=178 border=0>
<TBODY>
<TR>
<TD width="53" height=26 valign="middle" class=h12>用户名:</TD>
<TD valign="middle"><input class=inputclass type=input tabindex=1 maxlength=20 size=15 name=username></TD>
</TR>
<TR>
<TD height=26 valign="middle" class=h12>密 码:</TD>
<TD height=26 valign="middle"><input class=inputclass type=password tabindex=1 maxlength=20 size=15 name=password></TD>
</TR>
<TR>
<TD height=26 valign="middle" class=h12><input type="checkbox" name="IfSave" value="0" class="radio" title=记住用户名和密码 id="IfSave"><label for="IfSave">记住</label></TD>
</TR>
<TR>
<TD height=40 class=h12> </TD>
<TD height=40 class=h12><input tabindex=1 type=image height=25 maxlength=15 width=58 src="images/login/LoginButton.gif" border=0 name=imageField onClick="return checkform()"><input tabindex=1 type=image height=25 width=58 src="images/login/LoginDel.gif" onclick="this.form.reset();return false;"></TD>
</TR>
</TBODY></TABLE>
</form>
<script language="javascript">
if (getCookie("InfoUserName")!=null){
var frm=document.loginform;
frm.username.value=getCookie("InfoUserName");
frm.password.value=getCookie("InfoUserPWD");
if (getCookie("InfoIfSave")==1){
frm.IfSave.checked=true;
}
}
</script>