javascript控制層顯示或隱藏的方法,javascript

來源:互聯網
上載者:User

javascript控制層顯示或隱藏的方法,javascript

本文執行個體講述了javascript控制層顯示或隱藏的方法。分享給大家供大家參考。具體實現方法如下:

<html><head><title>中國風</title><meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head><script language="JavaScript">function showLay1(){  lay1.style.visibility="visible";  lay2.style.visibility="hidden";  lay3.style.visibility="hidden";}function showLay2(){  lay1.style.visibility="visible";  lay2.style.visibility="visible";  lay3.style.visibility="hidden";}function showLay3(){  lay1.style.visibility="visible";  lay2.style.visibility="visible";  lay3.style.visibility="visible";}</script><body><div id="lay1" style="position:absolute; left:60px; top:30px; width:250px; height:200px; index:1; visibility:visible">這是第一層內容,它的背景是透明的</div><div id="lay2" style="position:absolute; left:60px; top:30px; width:250px; height:200px; index:2; visibility:hidden; background-color:silver">這是第二層內容,它的背景是灰色的</div><div id="lay3" style="position:absolute; left:60px; top:30px; width:250px; height:200px; index:3; visibility:hidden"><br><br><br>這是第三層內容,它的背景是透明的</div><form id="form1" style="position:absolute; left:70px; top:250px;"><input type="button" value="第一層" onclick="showLay1()"><input type="button" value="第二層" onclick="showLay2()"><input type="button" value="第三層" onclick="showLay3()"></form></body></html>

希望本文所述對大家的javascript程式設計有所協助。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.