Last active
September 5, 2016 10:03
-
-
Save jerrybendy/e918a4a43b29a3197661bc318ff867c2 to your computer and use it in GitHub Desktop.
获取 URL 参数的简单实现
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 getQueryString (name) { | |
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); | |
var r = window.location.search.substr(1).match(reg); | |
if (r != null) return unescape(r[2]); return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment