queryURLParameter

 1 String.prototype.myQueryURLParameter = function myQueryURLParameter(){
 2      var obj = {};
 3      this.replace(/([^?&#=]+)=([^?&#=]+)/g,function(){
 4          obj[arguments[1]] = arguments[2];
 5      });
 6      this.replace(/#([^?&#=]+)/g,function(){
 7          obj['hash'] = arguments[1];
 8      })
 9      return obj;
10 }
11 var str = 'http://kbs.sport.qq.com/kbsweb.htm?mid=10000&cid=1467086&app=1.0#teacher';
12 console.log(str.myQueryURLParameter());
原文地址:https://www.cnblogs.com/liufeiran/p/11162471.html