Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ccwq/967864a689d305163bbb292aa5e64df9 to your computer and use it in GitHub Desktop.
Save ccwq/967864a689d305163bbb292aa5e64df9 to your computer and use it in GitHub Desktop.
url的操作
location.href.replace(/(.+\/)(html)\/.+/,"$1");
/**
* 通过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