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