Skip to content

Instantly share code, notes, and snippets.

@337547038
Created March 12, 2018 06:41
Show Gist options
  • Save 337547038/0cb36f9dc852334f1b235855d76d0740 to your computer and use it in GitHub Desktop.
Save 337547038/0cb36f9dc852334f1b235855d76d0740 to your computer and use it in GitHub Desktop.
获取浏览器URL参数
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