1. The style is set as follows:
<style type="text/css"> .mask { position: absolute; top: 0px; filter: alpha(opacity=60); background-color: #777; z-index: 1002; left: 0px; opacity:0.5; -moz-opacity:0.5; }</style>
Where: opacity:0.5; is suitable for IE, -moz-opacit :0.5; Applicable to Firefox; you only need to add them, and you can use them in both Firefox and IE.
2. Specify the height and width of the layer.
<script type="text/javascript"> //兼容火狐、IE8 function showMask(){ $("#mask").css("height",$(document).height()); $("#mask").css("width",$(document).width()); $("#mask").show(); }</script>
3. Add the following code to
, and then you can see the effect:
<div id="mask" class="mask"></div><a href="javascript:;" onclick="showMask()" >点我显示遮罩层</a><br />