讓我來完善下
<!DOCTYPE?HTML> <html> <head> <meta?charset="utf-8"/> <meta?http-equiv="pragma"?content="no-cache"> <title>展開與收起特效</title> <style> body{ margin:?0?auto; padding:?0px; } #pn{ background:?#e8e8e8; width:?950px; display:?block; margin:?0?auto; padding:?5px; height:?auto; text-align:?center; position:relative; z-index:?1; overflow:?hidden; } .content{ margin:0?auto; padding:10px; width:950px; background:?gray; text-align:?center; height:40px; color:#fff; position:?relative; z-index:2; } </style> </head> <body> <div?id="pn"> <h1>歡迎來到英雄聯(lián)盟</h1> <h1>大幅廣告</h1> </div> <div> 敵軍還有30S到達(dá)戰(zhàn)場(chǎng),碾碎他們 <br> 正文 </div> <script> var?h?=?0; function?addH(){ if(h?<?300){ h?+=?5; document.getElementById("pn").style.height?=?h?+?"px"; }?else?{ return; } setTimeout(addH,?30); } function?subH(){ if(h?>?0){ h?-=?5; document.getElementById("pn").style.height?=?h?+?"px"; }?else?{ document.getElementById("pn").style.display?=?'none'; return; } setTimeout(subH,?30); } window.onload?=?function(){ addH(); setTimeout(subH,?5000); } </script> </body> </html>
2015-09-05
沒有縮進(jìn)的代碼真是看得累,誰(shuí)愿意看這樣的代碼。
2014-10-05
代碼看起來好累。。