函数:
1 function getUrlParam(name) { 2 var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); 3 var r = window.location.search.substr(1).match(reg); 4 if (r != null) return unescape(r[2]); return null; 5 }
example:
1 url= http://localhost:61091/Static/staffingForm.html?companyid=1 2 console.log(getUrlParam(companyid)); // 1