Home > Article > Web Front-end > JS method to automatically close the DIV layer prompt box at regular intervals_javascript skills
The example in this article describes how to use JS to automatically close the DIV layer prompt box at regular intervals. Share it with everyone for your reference. The specific analysis is as follows:
Here you use JS to set the time to control whether the DIV layer with the specified ID is displayed. You can implement an automatically closing prompt box. Once the time is up, it will be closed immediately. This will make your webpage more humane. The code is actually better than you think. It's even simpler, just one line of code.
<title>自动关闭的DIV层</title> <body onLoad=setTimeout("abc.style.display='none'",5000)> <div id="abc" style="background:yellow;padding:20px; position:absolute; left:92px; top:38px; width:200px; height:169px; z-index:1"> 友情提示:本层5秒后会消失! </div>
I hope this article will be helpful to everyone’s JavaScript programming design.