Last active
August 29, 2015 14:08
-
-
Save yanhaijing/e397dc45b7368638de26 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
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