当前位置:网站首页>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
边栏推荐
- On the problem of V-IF display and hiding
- vite配置proxy代理解决跨域
- Error in created hook: "referenceerror:" promise "undefined“
- Advantages and disadvantages of several note taking software
- Future 用法详解
- 440. 字典序的第K小数字(困难)-字典树-数节点-字节跳动高频题
- Leak detection and vacancy filling (6)
- 古代埃及希腊,数学用的什么进制
- 386. Dictionary order (medium) - iteration - full arrangement
- 41. 缺失的第一个正数
猜你喜欢
In JS, t, = > Analysis of
Tell the truth of TS
Matlab / Simulink simulation of double closed loop DC speed regulation system
Learning record of uni app dark horse yougou project (Part 2)
2022年流动式起重机司机国家题库模拟考试平台操作
嵌入式系统中,FLASH中的程序代码必须搬到RAM中运行吗?
Use of todesk remote control software
Hcip fifth experiment
Chrome浏览器的跨域设置----包含新老版本两种设置
SystemVerilog (VI) - variable
随机推荐
PC电脑使用无线网卡连接上手机热点,为什么不能上网
Ring back to origin problem - byte jumping high frequency problem
In embedded system, must the program code in flash be moved to ram to run?
Low code development platform sorting
圆环回原点问题-字节跳动高频题
[binary number] maximum depth of binary tree + maximum depth of n-ary tree
Ouvrir des contrats à terme, ouvrir des comptes en nuage ou faire confiance aux logiciels des sociétés à terme?
239. 滑动窗口最大值(困难)-单向队列、大顶堆-字节跳动高频题
Learning record of uni app dark horse yougou project (Part 2)
1217_使用SCons生成目标文件
【Appium】通过设计关键字驱动文件来编写脚本
双闭环直流调速系统matlab/simulink仿真
440. 字典序的第K小数字(困难)-字典树-数节点-字节跳动高频题
Entity Framework core captures database changes
587. 安装栅栏 / 剑指 Offer II 014. 字符串中的变位词
Model problems of stock in and stock out and inventory system
Index: teach you index from zero basis to proficient use
Listen for click events other than an element
Hcip fifth experiment
102. 二叉树的层序遍历