美文网首页
js获取地址栏参数方式

js获取地址栏参数方式

作者: who_rong | 来源:发表于2018-05-08 14:47 被阅读0次

functiongetRequest() {

  varurl = window.location.search; //获取url中"?"符后的字串

  vartheRequest = newObject();

  if(url.indexOf("?") != -1) {

    varstr = url.substr(1);

    strs = str.split("&");

    for(vari = 0; i < strs.length; i ++) {

      theRequest[strs[i].split("=")[0]]=decodeURI(strs[i].split("=")[1]);

    }

  }

  returntheRequest;

}

varid= getRequest().id;

相关文章

网友评论

      本文标题:js获取地址栏参数方式

      本文链接:https://www.haomeiwen.com/subject/fexwrftx.html