function loadPageVar (sVar) {
return decodeURI(window.location.search.replace(new RegExp("^(?:.*[&\\?]" + encodeURI(sVar).replace(/[\.\+\*]/g, "\\$&") + "(?:\\=([^&]*))?)?.*$", "i"), "$1"));
}
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
loadPageVar这个方法的作用就是通过正则匹配出当前页面url中的search中对应sVar对应的值;
如
http://www.example.com?a=12&b=hello接下来,解释一下这个函数,及这个很看似很复杂的正则
这样看起来是不是明白多了,希望对你有帮助