Skip to content

Instantly share code, notes, and snippets.

@think2011
Last active August 29, 2015 14:17
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 think2011/0659ce577c53c05d6430 to your computer and use it in GitHub Desktop.
Save think2011/0659ce577c53c05d6430 to your computer and use it in GitHub Desktop.
获取url参数 getParams.js
window.QUERYSTRING = (function () {
var params = {},
pair = (window.location.search.substr(1)).split('&');
if (pair[0]) {
for (var i = 0; i < pair.length; i++) {
var pos = pair[i].split('=');
params[pos[0]] = decodeURIComponent(pos[1]);
}
}
return params;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment