Home > Web Front-end > JS Tutorial > 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
Release: 2016-05-16 15:59:43
Original
1146 people have browsed it

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>
Copy after login

I hope this article will be helpful to everyone’s JavaScript programming design.

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template