主页 > 前端 > javascript >
来源:未知 时间:2015-07-23 09:07 作者:xxadmin 阅读:次
[导读] 本文讲解:javascript如何控制层显示或隐藏 具体代码如下: htmlheadtitle中国风/titlemetahttp-equiv=Content-Typecontent=text/html;charset=gb2312/headscriptlanguage=JavaScriptfunctionshowLay1(){lay1.style.visibility=visi...
本文讲解: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> |
自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习
京ICP备14009008号-1@版权所有www.zixuephp.com
网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com