实现局部遮罩与关闭

View Code
 1 //实现局部遮罩
 2 <script type="text/javascript">
 3     function Shade(){
 4         var s = document.getElementById("shade");
 5         s.style.display = "block";
 6     }
 7     function Display(){
 8         var d = document.getElementById("shade");
 9         d.style.display = "none";
10     }
11 </script>
12 <style type="text/css">
13 #box{
14     width:400px;
15     height:300px;
16     position:relative;
17     margin:0px auto;
18     border:1px solid #000;
19 }
20 #shade{
21     width:400px;
22     height:300px;
23     background-color:gray;
24     position:absolute;
25     z-index:999;
26     left:0px;
27     top:0px;
28     -moz-opacity:0.5;/*Firefox*/
29     opacity:0.5;/*Opera*/
30     filter:alpha(opacity=50); /*IE*/
31 }
32 </style>
33 </head>
34 
35 <body>
36     <div id = "box">
37         <a href = "javascript:Shade()">局部遮罩</a>
38         <div id = "shade"></div>
39     </div>
40 <a href = "javascript:Display()">遮罩消失</a>
41 </body>

 

转载于:https://www.cnblogs.com/zhouxy/archive/2012/08/01/2618899.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值