Skip to content

Instantly share code, notes, and snippets.

@yanhaijing
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yanhaijing/e397dc45b7368638de26 to your computer and use it in GitHub Desktop.
Save yanhaijing/e397dc45b7368638de26 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 unescape(r[2]); return null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment