国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > JavaScript > 正文

JS cookie中文亂碼解決方法

2024-05-06 16:00:12
字體:
來源:轉載
供稿:網友
本篇文章主要是對JS中的cookie中文亂碼解決方法進行了介紹,需要的朋友可以過來參考下,希望對大家有所幫助

復制代碼 代碼如下:


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


復制代碼 代碼如下:


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


decodeURIComponent 用這個轉換一下

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 睢宁县| 应用必备| 云南省| 石门县| 穆棱市| 永福县| 铜陵市| 历史| 大渡口区| 城口县| 洱源县| 东乡县| 东光县| 武威市| 政和县| 镇赉县| 云和县| 台江县| 罗甸县| 云安县| 含山县| 金沙县| 麟游县| 永仁县| 新建县| 五大连池市| 任丘市| 南岸区| 慈溪市| 都江堰市| 若羌县| 无锡市| 凤山县| 陆川县| 鄯善县| 如皋市| 大同市| 昌图县| 定远县| 察哈| 奈曼旗|