日前看到一個別人總結的讀寫Cookie的函數
function GetCookieVal(offset)
//獲得Cookie解碼後的值
{
var endstr = okie
if (endstr ==
endstr = okie
return unescape(okie
}
function SetCookie(name
//設定Cookie值
{
var expdate = new Date()
var argv = SetCookie
var argc = SetCookie
var expires = (argc >
var path = (argc >
var domain = (argc >
var secure = (argc >
if(expires!=null) expdate
okie = name +
+((path == null) ?
+((secure == true) ?
}
function DelCookie(name)
//刪除Cookie
{
var exp = new Date()
exp
var cval = GetCookie (name)
okie = name +
}
function GetCookie(name)
//獲得Cookie的原始值
{
var arg = name +
var alen = arg
var clen = okie
var i =
while (i < clen)
{
var j = i + alen;
if (okie
return GetCookieVal (j)
i = okie
if (i ==
}
return null;
}
From:http://tw.wingwit.com/Article/program/Java/JSP/201311/19190.html