Skip to content

Instantly share code, notes, and snippets.

@PeterRao
Created December 31, 2013 01:28
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 PeterRao/8190973 to your computer and use it in GitHub Desktop.
Save PeterRao/8190973 to your computer and use it in GitHub Desktop.
jS:获取URL参数
function getQueryStringRegExp(name) {
var reg = new RegExp("(^|\\?|&)"+ name +"=([^&]*)(\\s|&|$)", "i");
if (reg.test(location.href)) {
return unescape(RegExp.$2.replace(/\+/g, " "));
}
return "";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment