<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="text/javascript"> <BR>function Shade(){ <BR>var s = document.getElementById("shade"); <BR>s.style.display = "block"; <BR>} <BR>function Display(){ <BR>var d = document.getElementById("shade"); <BR>d.style.display = "none"; <BR>} <BR></script> <br><style type="text/css"> <BR>#box{ <BR>width:400px; <BR>height:300px; <BR>position:relative; <BR>margin:0px auto; <BR>border:1px solid #000; <BR>} <BR>#shade{ <BR>width:400px; <BR>height:300px; <BR>background-color:gray; <BR>position:absolute; <BR>z-index:999; <BR>left:0px; <BR>top:0px; <BR>-moz-opacity:0.5;/*Firefox*/ <BR>opacity:0.5;/*Opera*/ <BR>filter:alpha(opacity=50); /*IE*/ <BR>} <BR></style> <br> <br><br> <br><div id="box"> <br><a href="javascript:Shade()">局部遮罩</a> <br><div id="shade"></div> <br> </div> <br><a href="javascript:Display()">遮罩消失</a> <br> <br> </div>