javascript操纵cookie要领实例阐明

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

javascript操纵cookie要领,实例阐明了javascript针对cookie操纵的相关技巧,需要的伴侣可以参考下 本文实例讲述了javascript操纵cookie要领。分享给各人供各人参考。

javascript操纵cookie要领,实例阐明了javascript针对cookie操纵的相关技巧,需要的伴侣可以参考下

本文实例讲述了javascript操纵cookie要领。分享给各人供各人参考。具体如下:

// my methods for setting, reading and deleting cookies.

// i have methods to check for the existence of cookie names or values,

// to retrieve by name or value, and to create a formatted string of

// all the cookies.

// my site: andrew.dx.am

var setcookie = function (name, value, expires, path, domain, secure) {

// the caller should trim the name/value pair, if required.

// sets the name/value pair (encoded); 'expires' is the no. of days.

var expires_date;

if (expires) {

expires_date = new date();

expires_date.setdate(expires_date.getdate() + expires);

}

document.cookie = encodeuricomponent(name) + "=" +

encodeuricomponent(value) +

( ( expires ) ? ";expires=" + expires_date.toutcstring() : "" ) +

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

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

( ( secure ) ? ";secure" : "" );

};

var deletecookie = function (name, path, domain) {

// the caller should trim the name/value pair.

// encodes the name before deleting.

document.cookie = encodeuricomponent(name) + "=" +

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

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