Last active
August 29, 2015 14:17
-
-
Save think2011/0659ce577c53c05d6430 to your computer and use it in GitHub Desktop.
获取url参数 getParams.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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