Last active
April 18, 2018 10:50
-
-
Save morrxy/5171460ae346bb0219b2692b1f23a2dd to your computer and use it in GitHub Desktop.
[获取url查询串] #javascript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function queryString(name) { | |
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); | |
var r = window.location.search.substr(1).match(reg); | |
return r !== null ? decodeURIComponent(r[2]) : null | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment