第一种方式:手动解析 “location”对象

console.log(window.location);

使用这个对象做跳转:

window.location.href="";

第二种方式:正则解析URL地址

function GetQueryString(name){
  var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
  var r = window.location.search.substr(1).match(reg);
  if(r!=null)return unescape(r[2]);
   return null;
}
// 调用方法
alert(GetQueryString('参数1'));
alert(GetQueryString('参数2'));

 

相关文章:

  • 2021-06-22
  • 2021-05-20
  • 2021-10-14
  • 2022-01-10
  • 2022-12-23
  • 2022-12-23
  • 2021-05-31
猜你喜欢
  • 2021-06-02
  • 2021-08-08
  • 2021-06-22
  • 2021-06-23
  • 2022-01-01
相关资源
相似解决方案