Home >Web Front-end >JS Tutorial >js decompose url parameters (object-oriented-minimalist method application)_javascript skills

js decompose url parameters (object-oriented-minimalist method application)_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:51:031146browse

Before modification:

Copy code The code is as follows:



After modification:
Copy code The code is as follows:



Thanks to the grassroots programmers for rewriting this method to make it more rigorous and efficient. I will learn more about it later! ! !
Copy code The code is as follows:



Note:
1, substr() and substring(start,stop), extract the string between two specified characters between subscripts.
Important: Unlike the slice() and substr() methods, substring() does not accept negative arguments.
See http://www.jb51.net/w3school/js/jsref_substring.htm
2. location.search.substring(1), location.search is set or returned from question mark ( ?) The starting URL (query part).
See http://www.jb51.net/w3school/htmldom/prop_loc_search.htm
3. The exec() method is used to retrieve matches of regular expressions in a string. It’s too powerful, I don’t know how to use it yet
Referencehttp://www.jb51.net/w3school/js/jsref_exec_regexp.htm
4. Use decodeURIComponent() to encode the encoded URI decoding.
See http://www.jb51.net/w3school/js/jsref_exec_regexp.htm
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn