欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

JS cookie中文亂碼解決方法

 更新時(shí)間:2014年01月28日 09:51:45   作者:  
本篇文章主要是對JS中的cookie中文亂碼解決方法進(jìn)行了介紹,需要的朋友可以過來參考下,希望對大家有所幫助

復(fù)制代碼 代碼如下:

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;
    };


復(fù)制代碼 代碼如下:

 var currentServiceAliasName = getCookie("appName");
        var displayName = "";
        if (currentServiceAliasName != null && currentServiceAliasName != "" && currentServiceAliasName != "undefined")
            displayName = decodeURIComponent(currentServiceAliasName) + " . " + counterName;
        else
        displayName = counterName;

decodeURIComponent 用這個(gè)轉(zhuǎn)換一下

相關(guān)文章

最新評論