标签:
// http://www.a.com/db/bb4fgzyey?a=d%20ABC&r=efkk&rl=dfv3 function query(param) { var regx = eval("/" + param + "=\\S*/gi"); var match = regx.exec(location.search); if (match && match.length > 0) { console.log(match[0]); var str = match[0].split("&")[0]; str = str.replace(param + "=", ""); return str; } return ""; } query("a"); //d%20ABC
原始代码:
/r=\S*/gi.exec(location.search)[0].split("&")[0].replace("r=","")
or
location.search.match(/r=\S*/gi)[0].split("&")[0].replace("r=","")
标签:
原文地址:http://www.cnblogs.com/eturn/p/4353175.html