제가 아이디 기억하기를 만들었는데요..
이게여.. 로그아웃 하구 나면 화면에 기억이 되어 있는데요
인터넷을 끄고 다시 화면을 켜믄
아이디 기억이 안 되거든요
왜 그럴까여?
좀 알려주세요~~
==== 소스는
function setCookie (name, value, expires)
{
var todayDate = new Date;
todayDate.setDate(expires);
[안내]태그제한으로등록되지않습니다-document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + expires + ";"
}
function getCookie(Name)
{
var search = Name + "="
if ([안내]태그제한으로등록되지않습니다-document.cookie.length > 0)
{
// 쿠키가 설정되어 있다면
offset = [안내]태그제한으로등록되지않습니다-document.cookie.indexOf(search)
if (offset != -1)
{
// 쿠키가 존재하면
offset += search.length
// set index of beginning of value
end = [안내]태그제한으로등록되지않습니다-document.cookie.indexOf(";", offset)
// 쿠키 값의 마지막 위치 인덱스 번호 설정
if (end == -1)
end = [안내]태그제한으로등록되지않습니다-document.cookie.length
return unescape([안내]태그제한으로등록되지않습니다-document.cookie.substring(offset, end))
}
}
return "";
}
function saveid(){
var expdate = new Date();
// 기본적으로 30일동안 기억하게 함. 일수를 조절하려면 * 30에서 숫자를 조절하면 됨
if (Form1.checksaveid.checked)
expdate.setTime(expdate.getTime() + 1000 * 3600 * 24 * 30); // 30일
else
expdate.setTime(expdate.getTime() - 1); // 쿠키 삭제조건
setCookie("saveid", Form1.txtUserID.value, expdate);
}
function getid()
{
if(getCookie("saveid") != "")
{
Form1.txtUserID.value = getCookie("saveid")
Form1.checksaveid.checked = true;
}
}
function sendit()
{
if(Form1.txtUserID.value == "")
{
alert("아이디를 입력하세요.");
Form1.txtUserID.focus();
return false;
}
else if(Form1.txtPasswd.value == "")
{
alert("비밀번호를 입력하세요.");
Form1.txtPasswd.focus();
return false;
}
else if((Form1.txtPasswd.value).length < 6)
{
alert("비밀번호는 6자리 이상입니다");
Form1.txtPasswd.focus();
}
else
{
saveid()
<%=Page.GetPostBackEventReference(btnLogin)%>;
}
}
첫댓글 음., cookie expires 값 설정할 때 expires 대신에 expires.toGMTString(); 로 써보세요., cookie expires 에 값을 대입할 때 잘못된 값이 들어 갔을 수도 있으니깐요., 그럼.,
감사합니다..