当前位置:网站首页>Tool function --- get parameters from the address bar
Tool function --- get parameters from the address bar
2022-04-21 13:41:00 【monstkl】
One 、 Use scenarios
Get the parameters from the address bar
Two 、 My Usage Summary
1、 Use the obtained parameters , First judge whether there is , Maybe it doesn't exist , There should be fault tolerance
getQueryVariable(name) {
const href = decodeURI(location.href);
const index = href.indexOf("?");
const search = href.slice(index + 1);
if (search) {
const arr = search.split("&");
for (let i = 0; i < arr.length; i++) {
const pair = arr[i].split("=");
if (pair[0] === name) {
return pair[1];
}
}
}
return false;
},
版权声明
本文为[monstkl]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204211339444367.html
边栏推荐
- Could not load dynamic library ‘libcusolver.so.11‘
- Mushroom array (moving gauge)
- SQLyog导入sql文件
- Exercise questions and answers of basic theories and relevant laws and regulations in 2022 supervision engineer examination
- leetcode:824. 山羊拉丁文【简单字符串操纵】
- Suggestion: Alt + X marks the marked area. Can I cancel the marking?
- 哈夫曼编码
- [C] give the earth some light
- Longest common subsequence (I) (dynamic gauge)
- A great peripheral driver library! (based on stm32f4)
猜你喜欢

Mysql 浅析行锁如何减少冲突提高性能

程序员爆出自己的薪资税前月薪15000

Upgrade the jdbc driver to version 8.0.28 and connect the pit record of MySQL

Dynamic implementation of address book

International logistics centralized transportation system source code, overseas warehousing cross-border transshipment system source code

How to recover if U disk data is lost? U disk data recovery, two schemes completed

Code Huffman

二叉树创建及其线索化

Flink相关API开发及运行架构和实现原理详解

专家系统实例及其骨架系统
随机推荐
【csnote】db异常(冗余数据、修改异常、删除异常、插入异常)
Number II that occurs only once (hash, bit operation, logic circuit, finite state automata)
一级等保怎么做?要收费吗?等保要求是什么?
Mushroom array (moving gauge)
metasploit渗透
被迫选择了到了外包公司
Filter string only retains the alphabetic characters in the string (10 points). Please write a function fun. The function is to enter a string, filter the string, only retain the alphabetic characters
字符串 - 1. 字符串長度 (10 分)C語言標准函數庫中包括 strlen 函數,用於計算字符串的長度。作為練習,我們自己編寫一個功能與之相同的函數。
SQLyog导入sql文件
海口等保测评公司有几家?具体在哪里?哪里可以查到?
北京大学ACM Problems 1011:Sticks
Peking University ACM problems 1010: stamps
Metasploit penetration
Flink相关API开发及运行架构和实现原理详解
Xcode Cloud 入门:拉取请求 (PR) 工作流程
List存放map值
制造业中小企业转型能力建设分享
通讯录的动态实现
Huffman coding
Achieve random labels, font size, color random display