js顯示隱藏div層代碼
<script language=javascript>
function toExit(){<!--對隱藏層的操作-->
var args=toExit.arguments;<!--擷取函數的輸入值-->
var visible=args[0];<!--函數的第一個輸入值-->
if(document.all){<!--對於ie瀏覽器-->
if(visible=='show')visible='visible';<!--設定隱藏層顯示-->
if(visible=='hide')visible='hidden';<!--設定隱藏層消失-->
theObj=eval("document.all['"+args[1]+"']");
if(theObj)theObj.style.visibility=visible;<!--執行上述操作-->
}
}
</script>
<div id=div32
style="HEIGHT: 80px; LEFT: 10px; POSITION: absolute; TOP: 10px; VISIBILITY: hidden; WIDTH: 180px; Z-INDEX: 1">
<table bgcolor=#FF9900 border=1 cellpadding=0 cellspacing=0 height=80
width=180> <tbody>
<tr>
<td height=65 width="100%">
<table border=0 cellpadding=0 cellspacing=0 height=80 width="99%">
<tbody>
<tr>
<td height=57> <font
color=#ffffff>歡迎來到javascript世界!這裡有你意想不到奇妙效果!<b></b></font></td>
</tr>
<tr align="center">
<td height=23 width="100%"><a
href="javascript:toExit('hide','div32')"><font color=white>關閉此層</font></a></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<a href="javascript:toExit('show','div32')"><font color="#FF9900">開啟隱藏層</font></a>
<body>
</body>
</html>
<!--本常式實習了開啟活隱藏層的操作-->
<!--瞭解隱藏層的產生機制-->
<!--開啟、關閉隱藏層的造作實現-->
<!--函數的調用-->