Jquery獲取URL中的參數,解決參數中文亂碼的問題。
//獲取url中的參數
function getUrlParamCN(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //構造一個含有目標參數的正則表達式對象
var r = decodeURI(window.location.search).substr(1).match(reg); //匹配目標參數
if (r != null) return unescape(r[2]); return null; //返回參數值
}