jquery截取地址栏中url参数的值

<script>
/*http://127.0.0.9/index.php?s=/Home/Index/fangguan_shuju&zc=2*/
    
function getQueryString (name){
  var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
  var r = window.location.search.substr(1).match(reg);
  if (r != null) return unescape(r[2]); return null;
};

var aa= getQueryString("zc");//我只获取zc的get值

console.log(aa);
    
</script>

 

posted @ 2018-02-23 17:23  遇事稳坐钓鱼台  阅读(1359)  评论(0编辑  收藏  举报