js采用正则表达式获取地址栏参数

getQueryString:function(name) {
var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
var r = decodeURI(decodeURI(window.location.search)).substr(1).match(reg);
if(r!=null)return unescape(r[2]); return null;
}
posted @ 2018-11-15 11:58  liw66  阅读(409)  评论(0编辑  收藏  举报