函数:

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

 

 posted on 2013-12-05 10:41  东方云游  阅读(540)  评论(0编辑  收藏  举报