<div class="codetitle"> <span><a style="CURSOR: pointer" data="50437" class="copybut" id="copybut50437" onclick="doCopy('code50437')"><u>複製程式碼</u></a></span>如下程式碼:</div> <div class="codebody" id="code50437"> <br>//實作局部遮擋罩<br><script type="="> <BR>function Shade(){ <BR>var s = document.getElementById("shade"); <BR>s.style.display = "block"; <BR>} <BR>函數Display( ){ <BR>var d = document.getElementById("shade"); <BR>d.style.display = "none"; <BR>} <BR></腳本> <BR><樣式類型=“text /css”> <BR>#box{ <BR>寬度:400px; <BR>高度:300px; <BR>位置:親屬; <BR>邊距:0px 自動; <BR>邊框:1px實心#000; <BR>} <BR>#shade{ <BR>寬度:400px; <BR> 高度:300px; <BR> 背景顏色:灰色;<BR>位置:絕對;<BR>z-index:999; <BR>左:0px; <BR>上:0px; <BR>-moz-opacity:0.5;/*Firefox*/ <BR>opacity:0.5;/*Opera*/ <BR>filter:alpha(opacity=50) ; /*IE*/ <BR>} <BR> <BR></頭> <br><br><身體> <BR><div id = "box">; <BR><a href = "javascript:Shade()">局部遮罩; <BR><div id = "shade"></script> </div>; <br> <br><a href="javascript%20:Display()">遮罩消失</a>; <br>身體> <br>