<% vbs response.Cookies("name").ExpiresAbsolute=#May 31,1996 13:30:15# %>js: function setCookie() { // get the information // var the_name = prompt("What's your name?",""); var the_date = new Date("December 31, 2023"); var the_cookie_date =the_date.toGMTString(); // build and save the cookie // var the_cookie = "my_cookie=" + escape(the_name); the_cookie = the_cookie +";expires=" + the_cookie_date; document.cookie = the_cookie; }
有没有办法,让cookie永远不过期的啊?
默认不设时间,是关闭浏览器就失效 永不过期???人家一清COOKIE,你不就失效了?
我对这个一点也不懂,我写了一个网页,要是用JAVASCRIPT怎么写啊,谢谢了,帮忙了啊
如下这样设置即说明此页立即过期 <meta http-equiv="expires" content="0"> 看着页面里那个位置合适放,呵呵 var iscookie=navigator.cookieEnabled alert(iscookie) 若真,则支持 若假,不支持 给个设置cookie的东东 function setcookieval(key, val){ document.cookie = key+'='+val+';path=/';
response.Cookies("name").ExpiresAbsolute=#May 31,1996 13:30:15#
%>js:
function setCookie()
{
// get the information
//
var the_name = prompt("What's your name?","");
var the_date = new Date("December 31, 2023");
var the_cookie_date =the_date.toGMTString();
// build and save the cookie
//
var the_cookie = "my_cookie=" + escape(the_name);
the_cookie = the_cookie +";expires=" + the_cookie_date;
document.cookie = the_cookie;
}
永不过期???人家一清COOKIE,你不就失效了?
<meta http-equiv="expires" content="0">
看着页面里那个位置合适放,呵呵 var iscookie=navigator.cookieEnabled
alert(iscookie)
若真,则支持
若假,不支持
给个设置cookie的东东
function setcookieval(key, val){ document.cookie = key+'='+val+';path=/';
}第一个参数是cookie名称
第二个参数是cookie的值
关闭浏览器就失效