您的位置:首页 > Web前端 > JavaScript

JS cookie中文乱码解决方法

2014-01-28 09:51 549 查看
function SetCookie(name, value) {        var exp = new Date();        exp.setTime(exp.getTime() + 3 * 24 * 60 * 60 * 1000); //3天过期        document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString();        return true;    };

    function getCookie(name) {        var arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"));        if (arr != null) return arr[2]; return null;    };

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  JS cookie 中文乱码