<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
function shade(){
//获得ID为"a"的标签对象
var aa = document.getElementById("a");
//使aa使用.a的CSS样式
aa.className = "a";
}
</script>
<style type="text/css">
html,body{
/*清空html,body中的默认空白*/
margin:0px;
padding:0px;
}
.a{
background-color:pink;
width:100%;
height:100%;
position:absolute;/*绝对位子*/
top:0px;
left:0px;
z-index:123;
/*透明效果*/
-moz-opacity:0.5;/*Firefox*/
opacity:0.5;/*Opera*/
filter:alpha(opacity=50); /*IE*/
}
</style>
</head>
<body>
<a href="javascript:shade()">遮罩</a>
<a href="http://www.baidu.com">baidu</a>
<div id="a"></div>
</body>
</html>
浙公网安备 33010602011771号