首页 > 代码库 > JS写cookie

JS写cookie

(function(){
 var name = "whr";//cookie的名字
 var value = "http://www.mamicode.com/whr1";//cookie的值
 var aaa = new Date((new Date()).setTime((new Date()).getTime() + (24 * 60 * 60 * 1000))).toUTCString()
 document.cookie = name+‘=‘+value+‘;expires=‘+aaa+‘;path=/;‘;
})();