这个代码 具体是什么意思!
本帖最后由 yulelcom 于 2013-03-27 22:56:21 编辑
function singplay() {
var self = this;
this.prefix = "sing_play__fm_";
this.playIndex = -1;
this.listIndex = { PlayList: 0, MusicBox: 1 };
this.isLogin = false;
this.countMusicbox = -1;
this.cookieList = { PlayList: this.prefix + "0", MusicBox: this.prefix + "1" };
this.cookie;
this.agent;
this.init();
}
singplay.prototype.init = function () {
var self = this;
this.cookie = self.cookieList.PlayList;
};
singplay.prototype.setCurrentCookie = function (o) {
this.cookie = o;
};查找数组中是否包含某个元素
*/
Array.prototype.include = function (val) {
return this.index(val) !== null;
}
//#endregion
//#region getCookie
/*获取cookie
*/
function getCookie(name) {
var arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"));
if (arr != null) return JSON.parse(unescape(arr[2])); return null;
}
function getcookie(name)//取cookies函数
{
var arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"));
if (arr != null) return unescape(arr[2]); return null;
}
//#endregion
//#region setCookie
/*设置cookie
*/
function setCookie(name, value) {
var Days = 30; //此 cookie 将被保存 30 天
var exp = new Date(); //new Date("December 31, 9998");
exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);
document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString();
//alert(getCookie(name) + "||" + name);
}
//#endregion
//#region deleteCookie
/*删除cookie
*/
function deleteCookie(name, path, domain) {
if (getcookie(name)) {
document.cookie = name + '=' +
((path) ? ';path=' + path : '') +
((domain) ? ';domain=' + domain : '') +
';expires=Thu, 01-Jan-1970 00:00:01 GMT';
}
}
怎么改成不 覆盖
用PHP 或者的话 要怎么写
javascript function
[解决办法]
粗粗看过去你还没找到关键的代码。搜一下 singplay
[解决办法]
嗯,搜一下 setCookie
[解决办法]
你没发出关键的代码,找一代码里那个部分调用了 setCookie
[解决办法]
不是说两个文件吗?还有一个文件在那?也有可能没有调用setCookie,你给的代码只是实现没有调用。
再试试查找addToPlaylist,saveData,估计在saveData里。