Posted in Javascript onJanuary 28, 2014
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 用这个转换一下
JS cookie中文乱码解决方法
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@