我正在尝试隐藏ID“隐藏首页”,并且它总体上可以正常工作,但第二种情况是我希望将其隐藏在指定的URL(http://wgzrv.ndxva.servertrust.com/login.asp)中。我想念什么吗?
<script type="text/javascript">
$(window).resize(function(){
function showMyDiv() {
if (window.location.href == "http://wgzrv.ndxva.servertrust.com") && (document.documentElement.clientWidth > 992) {
document.getElementById("hide-homepage").style.display="none";
} else if (window.location.href == "http://wgzrv.ndxva.servertrust.com/login.asp") {
document.getElementById("hide-homepage").style.display="none";
} else if (document.documentElement.clientWidth < 992) {
document.getElementById("hide-homepage").style.display="none";
} else {
document.getElementById("hide-homepage").style.display="block";
}
}
});
</script>
最佳答案
if (window.location.href == "http://wgzrv.ndxva.servertrust.com") && (document.documentElement.clientWidth > 992) {
应该
if (window.location.href == "http://wgzrv.ndxva.servertrust.com" && document.documentElement.clientWidth > 992) {