分类分类
更新时间:2026-11-27 00:53:10作者:fang
本文实例讲述了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程序设计有所帮助。
相关
轻听英语学习办公88.4 MBv2.7.212026-11-26
下载喵喵王国角色扮演1.15Gv00.40.012026-11-26
下载pokecatch游戏休闲益智410Kv1.02026-11-26
下载摇曳露营拼图露营休闲益智82.14 Mv1.7.52026-11-26
下载暗金秘录角色扮演316.84 Mv0.365.02026-11-26
下载AI剪辑图像拍照196.82 MBv21.52026-11-25
下载精灵联萌0.05折版策略游戏13.63 Mv1.0.02026-11-25
下载MilkSU内核管理器实用工具14.29 Mv0.2.62026-11-25
下载百炼仙途角色扮演528.9 Mv10002026-11-25
下载蛊界永生角色扮演407.01 Mv0.4.162026-11-25
下载幻梦无年动作射击276.68 Mv1.1.02026-11-25
下载假人慢打漂泊带土动作射击856.96 Mv0.9.02026-11-25
下载










