js获取地址栏参数

& lt;脚本type=" text/javascript在

, $(函数(){

window.location。href=" https://www.yisu.com/zixun/xx.aspx?newsclass=" + getUrlParam (newsclass);

//此处因为有其他判断所有用jquery,正常用js跳转就可以

,})

函数getUrlParam(名字){


,,,var reg=new RegExp (”(^ |,)”+名字+”=((^和)*)(和| $)”);//构造一个含有目标参数的正则表达式对象


,,,var r=window.location.search.substr (1) .match(注册);,//匹配目标参数


,,,如果(r !=null)返回unescape (r [2]);返回null;//返回参数值

}

& lt;/script>



js获取地址栏参数