当前位置:网站首页>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
边栏推荐
- Leak detection and vacancy filling (VII)
- QT modification UI does not take effect
- 41. 缺失的第一个正数
- [appium] write scripts by designing Keyword Driven files
- 开期货,开户云安全还是相信期货公司的软件?
- Halo open source project learning (II): entity classes and data tables
- Use of five routing guards
- 2022年茶艺师(初级)考试模拟100题及模拟考试
- 土地覆盖/利用数据产品下载
- SQL optimization for advanced learning of MySQL [insert, primary key, sort, group, page, count]
猜你喜欢
Land cover / use data product download
编译原理 求first集 follow集 select集预测分析表 判断符号串是否符合文法定义(有源码!!!)
Use of todesk remote control software
HCIP第五次实验
On the method of outputting the complete name of typeID from GCC
Use of five routing guards
440. The k-th small number of dictionary order (difficult) - dictionary tree - number node - byte skipping high-frequency question
MySQL进阶之索引【分类,性能分析,使用,设计原则】
Uniapp custom search box adaptation applet alignment capsule
Kubernetes 服务发现 监控Endpoints
随机推荐
JVM class loading mechanism
SystemVerilog (VI) - variable
Header built-in object
How to change input into text
MySQL进阶之索引【分类,性能分析,使用,设计原则】
Construction of functions in C language programming
JS interview question: FN call. call. call. Call (FN2) parsing
440. The k-th small number of dictionary order (difficult) - dictionary tree - number node - byte skipping high-frequency question
Leak detection and vacancy filling (VIII)
JVM类加载机制
Indexes and views in MySQL
ECMAScript history
Qt error: /usr/bin/ld: cannot find -lGL: No such file or directory
HCIP第五次实验
122. 买卖股票的最佳时机 II-一次遍历
48. Rotate image
Collection of common SQL statements
PC uses wireless network card to connect to mobile phone hotspot. Why can't you surf the Internet
Come out after a thousand calls
Change Oracle to MySQL