Created
December 31, 2013 01:28
-
-
Save PeterRao/8190973 to your computer and use it in GitHub Desktop.
jS:获取URL参数
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
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