javascript操纵cookie要领实例阐明(2)

来源: 电脑维修教程   阅读:     发表时间:

( ( path ) ? ";path=" + path : "") + ( ( domain ) ? ";domain=" + domain : "" ) + ";expires=fri, 01-jan-2010 00:00:01 utc"; }; var delallcookies = function () { var currdate = new date(), i, thecookie

( ( path ) ? ";path=" + path : "") + ( ( domain ) ? ";domain=" +

domain : "" ) + ";expires=fri, 01-jan-2010 00:00:01 utc";

};

var delallcookies = function () {

var currdate = new date(), i, thecookie = document.cookie.split(";");

currdate = currdate.toutcstring();

i = thecookie.length;

while ( i-- ) {

document.cookie = thecookie[i] + "; expires =" + currdate;

}

};

var escapereg = function (str) {

// helper fn: escapes characters for use in a regular expression.

return str.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");

};

// the following four functions do not trim the name or value

// - the calling fns should do this.

var cnameexists = function (cookie_name) { // case-insensitive

var testname, myreg;

if (document.cookie.length == 0) return false;

testname = escapereg(cookie_name);

myreg = new regexp('(^|;) ?' + testname + '=([^;]*)(;|$)','i');

return myreg.test(decodeuricomponent(document.cookie));

};

var cvalueexists = function (cookie_value) { // case insensitive

var testname, myreg;

if (document.cookie.length == 0) return false;

testname = escapereg(cookie_value);

myreg = new regexp('(=)' + testname + '(;|$)','i');

以上是:解决javascript操纵cookie要领实例阐明(2)问题的详细资料教程

?
热门链接: 机顶盒 | 主板维修 | 声卡怎么安装 | 路由器怎么设置 | 电脑内存维修技术 | 维修大全?| 主板维修资料 | 电脑声卡音响故障维修 | 内存 | 显示器 | 电源维修教程 | cpu | 硬盘 | 显卡 |win8操作系统教程|linux操作系统教程|ubuntu操作系统教程|mac苹果操作系统教程|execl教程
友情链接: ?苹果手机维修?| 更多...