Created
March 12, 2018 06:41
-
-
Save 337547038/0cb36f9dc852334f1b235855d76d0740 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 r[2]; | |
} | |
else { | |
return ""; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment