获取地址栏参数

 
getUrlParams(name){
var rReg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"); //构造一个正则表达式对象
var oaUrl = window.location.hash.substr(window.location.hash.indexOf('?'),window.location.hash.length).substr(1).match(rReg); //匹配参数对象
if( oaUrl !=null ){ //返回参数
return decodeURI(oaUrl[2])
}
return null;
}

posted on 2020-06-08 16:21  lyuyi  阅读(131)  评论(0编辑  收藏  举报

导航