Open Sogrey opened 3 years ago
function GetQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); var r = window.location.search.substr(1).match(reg); //search,查询?后面的参数,并匹配正则 if (r != null) return decodeURI(r[2]); return null; }
使用举例:
// 比如当前网址: 'http://sogrey.top/Linux-start/zh/commands/?type=FileSystem' GetQueryString('type'); //FileSystem
使用举例: