JavaScriptはCookieを読み、書きます.
712 ワード
Cookieを書く:
function saveUsername(theForm) {
var expires = new Date();
expires.setTime(expires.getTime() + 24 * 30 * 60 * 60 * 1000); // sets it for approx 30 days.
setCookie("username",theForm.j_username.value,expires);
}
Cookieを読む:
if (getCookie("username") != null) {
if (document.getElementById) {
document.getElementById("j_username").value = getCookie("username");
document.getElementById("j_password").focus();
}
} else {
document.getElementById("j_username").focus();
}