获取到当前网址

var url = window.location.href;

 

http://localhost:8080/exam_questions?type=3

//获取url中的参数
function getUrlParam(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
var r = window.location.search.substr(1).match(reg); //匹配目标参数
if (r != null) return unescape(r[2]); return null; //返回参数值
}

 

获取到url中的type=后面的值
var xx = getUrlParam('type');

相关文章:

  • 2021-07-28
  • 2021-05-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-16
  • 2022-12-23
  • 2021-10-16
猜你喜欢
  • 2022-02-09
  • 2022-02-09
  • 2022-12-23
  • 2022-02-09
  • 2021-08-14
  • 2021-08-12
  • 2022-12-23
相关资源
相似解决方案