⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cookie.js

📁 原名JSPackager
💻 JS
字号:
function Cookie(path,expires,domain)
{
  this.path = path;
  this.expires = expires;
  this.domain = domain;
}

/**
 * Sets cookie
 * @param {String} name the name of cookie item
 * @param {String} value the value of cookie item
 */
Cookie.prototype.setValue = function (name, value)
{
	document.cookie = name + "=" + escape(value) 
		+ this.getSubfix()+";";
}
Cookie.prototype.getSubfix = function (){
	var subfix = "";
	subfix += (this.domain == null) ? "" 
		: ("; domain=" + this.domain);
	subfix += (this.path == null) ? "" 
		: ("; path=" + this.path);
	subfix += (this.expires == null) ? "" 
		: ("; expires=" + this.expires.toGMTString());
	return subfix;
}
/**
 * Returns cookie value with name.
 * @return  a string
 * @type String
 */
Cookie.prototype.getValue = function (name)
{
	return (new RegExp(" " + name + "=([^;]*)").test(
		" " + document.cookie)) ?
			unescape(RegExp.$1) : null;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -