Created
March 29, 2016 06:30
-
-
Save hcl1687/aa9d4cc6b4a06b890a02 to your computer and use it in GitHub Desktop.
getURLParam
获取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
// 获取参数 | |
function getURLParam (name) { | |
return decodeURIComponent( | |
(new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search) || | |
['', ''])[1].replace(/\+/g, '%20')) || null | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment