点击打开层5秒后自动隐藏
javascript 代码
- <!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
- <title> 5秒后自动关闭 诺豆网 Nuodou.com </title>
- <script language="javascript">
- function showdiv()
- {
-
document.getElementById(
"hidediv").style.display=""; -
setTimeout(
function(){document.getElementById('hidediv').style.display= 'none';},5000); - }
- </script>
- </head>
- <body>
- <div style="border:1px dashed #000000; width:300px; height:150px; display:none;" id="hidediv"> <br><br> 诺豆网 Nuodou.com<br><br> 我将于 5秒 后自动关闭 </div>
- <div >
- <input type="button" name="Submit" value="点此显示层" onclick="showdiv()" />
- </div>
- </body>
- </html>