function GetUrlByParamName(name) { var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"); var URL = decodeURI(window.location.search); var r = URL.substr(1).match(reg); if(r!=null){ //decodeURI() 函数可对 encodeURI() 函数编码过的 URI 进行解码 return decodeURI(r[2]); }; return null; };
转载于:https://my.oschina.net/u/3306200/blog/3098132