JS realizes the method of automatically closing the DIV layer prompt box on time

  • 2020-06-12 08:28:33
  • OfStack

An example of JS shows how to automatically close the DIV layer prompt box on time. Share to everybody for everybody reference. The specific analysis is as follows:

Here, JS is used to set the time to control whether the DIV layer specified in ID is displayed or not. It can realize an automatic closing prompt box. When the time arrives, it will be closed immediately.


<title> Self-Closing DIV layer </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">
 Tip: This layer 5 It'll be gone in two seconds! 
</div>

I hope this article has been helpful for your javascript programming.


Related articles: