zoukankan      html  css  js  c++  java
  • cookie

    GLOBAL.namespace('Cookie');
    GLOBAL.Cookie = {
        //读取
        read : function(name) {
            var cookieStr = '; ' + document.cookie + '; ';
            var index = cookieStr.indexOf('; ' + name + '=');
            if (index != -1){
                var s = cookieStr.substring(index + name.length + 3, cookieStr.length);
                return unescape(s.substring(0, s.indexOf('; ')));
            } else {
                return null;
            }
        };
    
        // 设置
        set : function(name, value, expires) {
            var expDays = expires * 24 * 60 * 60 * 1000;
            var expDate = new Date();
            expDate.setTime(expDate.getTime() + expDays);
            var expString = expires ? '; expires=' + expDate.toGMTString() : '';
            var pathString = ';path = /';
            document.cookie = name + '=' + escape(value) + expString + pathString;
        };
    
        // 删除
        del : function(name) {
            var exp = new Date(new Date().getTime() - 1);
            var s = this.read(name);
            if (s != numm){
                document.cookie = name + '=' + s +';expires = ' + exp.toGMTString() + ';path = /'
            };
        }
    };
    高否?富否?帅否? 否? 滚去学习!
  • 相关阅读:
    创建FLASK,同步docker
    FLASK Buleprint
    restful api
    Angular JS
    线程日志
    将项目部署到linux下的docker容器中
    安装和卸载docker
    学习目录总编
    Ansible
    装饰器
  • 原文地址:https://www.cnblogs.com/baixc/p/3938428.html
Copyright © 2011-2022 走看看