获取所有query string

function queryStringAll(src){
    src = src || location.search || location.hash;
    var reg = /[?&]([^?&=]+)=([^?&=]*)/g,
        res,
        obj = {};
    while(res = reg.exec(src)){
        obj[res[1]] = res[2] == null ? undefined : decodeURIComponent(res[2]);
    }
    return obj;
}

获取指定name的query string

function queryString(key,src){
    src = src || location.search || location.hash;
    var reg = new RegExp('[?&]' + key + '=([^?&=]*)(?=&|$)'),
        match = reg.exec(src);
    return match == null ? null : decodeURIComponent(match[1]);
}

 

参考:http://www.cnblogs.com/jiekk/archive/2011/06/28/2092444.html

          http://www.cnblogs.com/sohighthesky/archive/2010/01/21/1653126.html

有道词典
function queryS ...
详细X
]]> </input> <translation> <![CDATA[

相关文章:

  • 2021-11-04
  • 2022-12-23
  • 2022-01-09
  • 2021-05-31
  • 2021-06-02
  • 2022-02-25
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-23
  • 2022-12-23
  • 2021-05-20
相关资源
相似解决方案