Skip to content

Instantly share code, notes, and snippets.

@mtmzorro
Created March 4, 2015 08:07
Show Gist options
  • Save mtmzorro/b0ce27c9a0d8de0bf9f3 to your computer and use it in GitHub Desktop.
Save mtmzorro/b0ce27c9a0d8de0bf9f3 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