Skip to content

Instantly share code, notes, and snippets.

@morrxy
Last active April 18, 2018 10:50
Show Gist options
  • Save morrxy/5171460ae346bb0219b2692b1f23a2dd to your computer and use it in GitHub Desktop.
Save morrxy/5171460ae346bb0219b2692b1f23a2dd to your computer and use it in GitHub Desktop.
[获取url查询串] #javascript
function queryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
return r !== null ? decodeURIComponent(r[2]) : null
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment