我写的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()">
<div class="brpop" id="laohei-show" style="position: absolute;overflow: hidden;width: 100%;height: 100%;z-index: 2;top: 0;display: none;">
<div 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>
</div>
</div>
</body>
style 属性要加引号,你看控制台应该会有错误提示,因为这个属于语法错误。
if 后面的判断应该是
==
用 setInterval
if 的位置也不对。