Last active
March 31, 2017 07:00
-
-
Save ccwq/967864a689d305163bbb292aa5e64df9 to your computer and use it in GitHub Desktop.
url的操作
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
location.href.replace(/(.+\/)(html)\/.+/,"$1"); |
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
/** | |
* 通过key获取url参数值 | |
* @param key | |
* @param url | |
* @returns {*} | |
*/ | |
var getParamsValue = function(key,url){ | |
if(!url) url = location.href; | |
url = url.split("?").pop(); | |
if(new RegExp(key + "=([^=&]*)").test(url)) { | |
return RegExp["$1"]; | |
} | |
return ""; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment