Home  >  Article  >  Web Front-end  >  JS method to automatically close the DIV layer prompt box at regular intervals_javascript skills

JS method to automatically close the DIV layer prompt box at regular intervals_javascript skills

WBOY
WBOYOriginal
2016-05-16 15:59:431128browse

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.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn