本文實(shí)例講述了JavaScript實(shí)現(xiàn)廣告的關(guān)閉與顯示效果。分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:
js代碼部分如下:
<script language="javascript"> <!-- function display(){ if(googlead.style.visibility == 'visible'){ googlead.style.visibility ='hidden' ; document.getElementById('words').innerHTML='關(guān)閉'; return true; } else{ googlead.style.visibility='visible'; document.getElementById('words').innerHTML='顯示'; return false; } } //--> </script> html部分如下:
<div id="googlead" style="margin-bottom:5px;width:728px;height:90px;float:left;visibility:visible">換客網(wǎng)廣告...</div> <div id="myid" ><span id="words" onclick="return display()">關(guān)閉</span></div>
希望本文所述對(duì)大家的javascript程序設(shè)計(jì)有所幫助。
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注