我写的JS代码怎么没反应?哪里有问题?
<script>
function brpop(){
var av = document.getElementById("laohei-show");
if(av.style.display = none){
setTimeout(function(){
av.style.display = block;
},3000);
}else{
av.style.display = none;
}
}
</script>
</head>
<body onload="brpop()">
<p class="brpop" id="laohei-show" style="position: absolute;overflow: hidden;width: 100%;height: 100%;z-index: 2;top: 0;display: none;">
<p class="popbox" style="margin: 0 auto;top: 20%;position: relative;overflow: hidden;text-align: center;">
<a href="//www.163.com"><img src="xinxi.jpg" alt=""></a>
</p>
</p>
</body>
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
style 属性要加引号,你看控制台应该会有错误提示,因为这个属于语法错误。
if 后面的判断应该是
==用 setInterval
if 的位置也不对。