获取地址栏URL的属性

1  // alert(getQueryString('departmentName'));
2 
3 function getQueryString(name) {
4      var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
5      var r = window.location.search.substr(1).match(reg);
6      if (r != null) return decodeURI(r[2]);
7      return null;
8 }

 

posted @ 2018-11-06 02:23  祗堂幻狼  阅读(194)  评论(0编辑  收藏  举报