Last active
April 6, 2017 05:58
-
-
Save ladyrick/64b25fe2ec63da7cc0843fbb23afaa46 to your computer and use it in GitHub Desktop.
用JS获取地址栏参数的方法
This file contains 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 GetQueryString(name) | |
{ | |
var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"); | |
var r = window.location.search.substr(1).match(reg); | |
if(r!==null) { | |
return unescape(r[2]); | |
} else { | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment