<script> function c(obj) { console.log(obj); } /** * [通过参数名获取url中的参数值] * 示例URL:http://htmlJsTest/getrequest.html?uid=admin&rid=1&fid=2&name=小明 * @param {[string]} queryName [参数名] * @return {[string]} [参数值] */ function GetQueryValue1(queryName) { var url=window.location.href; var reg = new RegExp("(^|&)" + queryName + "=([^&]*)(&|$)", "i"); var r = url.substr(1).match(reg); if ( r != null ){ return decodeURI(r[2]); }else{ return null; } } var parm1=GetQueryValue1("parm1"); //合同建模ID alert(parm1); </script>
标签:浏览器,url,queryName,js,参数,var,return,parm1 From: https://www.cnblogs.com/hua900822/p/17265008.html