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信息");
}

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-13
  • 2021-08-14
  • 2021-12-21
  • 2021-10-07
猜你喜欢
  • 2021-11-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-16
  • 2021-11-25
  • 2022-12-23
相关资源
相似解决方案