10-02-2007, 20:59
|
|
|
חבר מתאריך: 10.09.04
הודעות: 1,032
|
|
עודכן...
http://www.codepost.org/view/440
לקחתי את הרעיון שלך. זו דרך יותר נכונה לעבוד ובעקרון אני לא ממש יודע למה זה עבד עד עכשיו
אני מצרף את הקוד ללא ההערות...
קוד PHP:
var Cookie = { Read: function(sName){ if(typeof sGetNames == "undefined" || sGetNames != document.cookie) sGetNames = document.cookie.split("; "); for(var i=0; i<sGetNames.length; i++){ if((sGetNames[i].search(sName+"=") == 0)){ return sGetNames[i].substring(sGetNames[i].search("=")+1, sGetNames[i].length); } } return false; }, Write: function(sName, sValue, iDays){ if(iDays){ var dCurrent = new Date(); dCurrent.setTime(dCurrent.getTime()+(iDays*24*60*6 0*1000)); var sExp = "; expires="+dCurrent.toGMTString(); }else sExp = ""; document.cookie = sName.concat("=", sValue, sExp, "; path=/"); }, Remove: function(sName){ this.Write(sName, "", -1); } };
_____________________________________
|