Created
April 24, 2017 03:58
-
-
Save hello-qu/fb4f09c854ea09791d791c7ad9db4822 to your computer and use it in GitHub Desktop.
获取url中字符串的参数
This file contains hidden or 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
var getQueryString = function (str) { | |
var reg = new RegExp("(^|&)" + name + "([^&]*)(&|$)", "i"); | |
var res = window.location.search.substr(1).match(reg); | |
if (!res) { | |
return decodeURIComponent(res[2]); | |
} else { | |
return decodeURIComponent(str); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment