获取URL参数

function getQueryString(name) {
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
var r = window.location.search.substr(1).match(reg);
if (r != null) {
return unescape(r[2]);
}
return null;
}

alert(getQueryString("参数名"));

如:
https://test1.com/gourid=1&date=2018-02-15

(getQueryString("date")==2018-02-15) =true

你可能感兴趣的:(获取URL参数)