function getUrlParam(url, name) { var pattern = new RegExp("[?&]" + name + "\=([^&]+)", "g"); var matcher = pattern.exec(url); var items = null; if (matcher != null) { try { items = decodeURIComponent(decodeURIComponent(matcher[1])); } catch (e) { try { items = decodeURIComponent(matcher[1]); } catch (e) { items = matcher[1]; } } } return items; } console.log(getUrlParam(window.location.search, "customerid"));
时间: 2024-10-11 11:51:29