当前位置:网站首页>JS get link? The following parameter name or value, according to the URL? Judge the parameters after
JS get link? The following parameter name or value, according to the URL? Judge the parameters after
2022-04-23 17:44:00 【Youyoujing】
var url = location.search; // obtain url in "?" The string after the sign , Include ?
console.log(url);
function GetRequest() {
var url = location.search; // obtain url in "?" The string after the sign
var theRequest = new Object();
if(url.indexOf("?") != -1) {
var str = url.substr(1);
strs = str.split("&");
for(var i = 0; i < strs.length; i++) {
theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
}
}
return theRequest;
}
var Request = undefined;
Request = GetRequest();
console.log(Request);// Last obtained field name + value
const keys= Object.keys(Request);
console.log(keys);// Array
console.log(keys[0]);// Output a
Case study :
Design draft :
according to url The parameter judgment status after is : resolved , Unresolved , All ;
var url = location.search; // obtain url in "?" The string after the sign , Include ?
// console.log(url);
function GetRequest() {
var url = location.search; // obtain url in "?" The string after the sign
var theRequest = new Object();
if(url.indexOf("?") != -1) {
var str = url.substr(1);
strs = str.split("&");
for(var i = 0; i < strs.length; i++) {
theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
}
}
return theRequest;
}
var Request = undefined;
Request = GetRequest();
// console.log(Request);// Last obtained field name + value
// const keys= Object.keys(Request);
// console.log(keys);// Array
// console.log(keys[0]);// Output a
let status = Request.status;
if(status == 2){
$('.tit05 .tit05div .zhuangtai').text(' All ');
}else if(status == 1){
$('.tit05 .tit05div .zhuangtai').text(' resolved ');
}else{
$('.tit05 .tit05div .zhuangtai').text(' Unresolved ');
}
Reference article :
js For a link ? The parameter name or value behind :https://www.cnblogs.com/zxcc/p/11454196.html
版权声明
本文为[Youyoujing]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230550532016.html
边栏推荐
- 2021长城杯WP
- Exercise: even sum, threshold segmentation and difference (two basic questions of list object)
- Advantages and disadvantages of several note taking software
- MySQL installation
- 122. 买卖股票的最佳时机 II-一次遍历
- Excel quickly and automatically fills the contents of a row on a blank cell
- How to sort the numbers with text in Excel from small to large instead of the first number
- 圆环回原点问题-字节跳动高频题
- Generating access keys using JSON webtoken
- 394. 字符串解码-辅助栈
猜你喜欢
Qt 修改UI没有生效
编译原理 求first集 follow集 select集预测分析表 判断符号串是否符合文法定义(有源码!!!)
Applet learning notes (I)
MySQL进阶学习之SQL优化【插入,主键,排序,分组,分页,计数】
SystemVerilog(六)-变量
958. 二叉树的完全性检验
01 - get to know the advantages of sketch sketch
On the problem of V-IF display and hiding
Gets the time range of the current week
[ES6] promise related (event loop, macro / micro task, promise, await / await)
随机推荐
Halo 开源项目学习(二):实体类与数据表
1217_ Generating target files using scons
EasymodbusTCP之clientexample解析
2022年流动式起重机司机国家题库模拟考试平台操作
stm32入门开发板选野火还是正点原子呢?
48. Rotate image
1217_使用SCons生成目标文件
Add drag and drop function to El dialog
Some questions some questions some questions some questions
Future 用法详解
读《Software Engineering at Google》(15)
On the problem of V-IF display and hiding
Chrome浏览器的跨域设置----包含新老版本两种设置
209. Minimum length subarray - sliding window
2021 Great Wall Cup WP
Node template engine (EJS, art template)
ES6 new method
[simple understanding of database]
Generating access keys using JSON webtoken
[appium] write scripts by designing Keyword Driven files