1.保存cookie
var oDate = new Date(); oDate.setDate(oDate.getDate() + 30);//有效期為30天 document.cookie = "name=www.wzh.com;expires=" + oDate;
2.讀取cookie
var res = document.cookie.substring(5); if (res != "www.wzh.com") { alert("沒有cookie信息"); }
1.保存cookie
var oDate = new Date(); oDate.setDate(oDate.getDate() + 30);//有效期為30天 document.cookie = "name=www.wzh.com;expires=" + oDate;
2.讀取cookie
var res = document.cookie.substring(5); if (res != "www.wzh.com") { alert("沒有cookie信息"); }
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。