













由于页面刷新,如何保存客户端信息,想到了cookie
读cookie:
function GetCookie(sName)
{
// cookies are separated by semicolons
//var aCookie = document.cookie;
for (var i=0; i < aCookie.length; i++)
{
// a name/value pair (a crumb) is separated by an equal sign
var aCrumb = aCookie[i].split("=");
if (sName == aCrumb[0])
return unescape(aCrumb[1]);
}
// a cookie with the requested name does not exist
return 1;
}
设置cookie
function SetCookie(sValue)
{
var the_cookie = "switch=" + escape(sValue);
document.cookie = the_cookie;//写入Cookie
}
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。