JavaScript+Css完成的一个小特效,当我们点击按钮后,DIV层缓缓向上收起,就像电动卷闸门一样,一直到层消失,再刷新就又出来了,也有点像电影院的开幕式效果。 看一下演示代码: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <head> <title>谢幕效果</title> <script type="text/javascript"> function counter(){ var clp = document.getElementById("clp"); clp.style.height=clp.offsetHeight-1+"px"; if(clp.offsetHeight>0) {setTimeout("counter()",10);} else if(clp.offsetHeight<=0){ clp.style.display="none" } } </script> <style type="text/css"> *,html{ border:0; padding:0; list-style:none; } #main{ width:950px; height:800px; position:relative; left:50%; margin-left:-475px; } #clp{ width:800px; height:800px; background:#39c; } </style> </head> <body> <div id="main"> <div id="clp"> <input type="button" onclick="counter()" value="烈火网(网页特效),点击查看效果!"/> </div> </div> </body> </html><br /><center>如不能显示效果,请按Ctrl+F5刷新本页,更多网页代码:<a href='http://www.veryhuo.com/' target='_blank'>http://www.veryhuo.com/</a></center>提示:可修改后代码再运行! 文章导航 仿QQ邮箱的弹出层代码,弹出确认框,可移动延迟打开层,打开网页几秒后弹出可关闭的浮动层