<html>
<head>
<title></title>
<style type="text/css">
<!--
body
{
margin:0px;
padding:0px;
}
.msgbg
{
background:#fff;
width:100%;
height:100%;
position: absolute;
z-index:100000;
left:0px;
top:0px;
right:0px;
filter: Alpha(opacity=0);/*IE,Firefox浏览器下的透明效果*/
-moz-opacity:0;
opacity:0;
}
#box
{
position: absolute;
top:40%;
left:40%;
background:#eee;
z-index:100001;
text-align:center;
}
-->
</style>
<script type="text/javascript">
function ShowModleDiv()
{
var bgObj=document.createElement("div");
bgObj.setAttribute('id','bgDiv');
bgObj.className="msgbg";
document.body.appendChild(bgObj);
var boxObj=document.createElement("div");
boxObj.setAttribute('id','box');
boxObj.innerHTML="数据处理中,请稍候…";
document.body.appendChild(boxObj);
box.focus();
}
</script>
</head>
<body>
<br />
<br />
<br />
<input type="button" value="测试屏蔽层" onclick="ShowModleDiv()" />
</body>
</html>
本文介绍了一个简单的HTML和JavaScript实现页面局部加载遮罩层的方法。通过创建并定位两个div元素,一个作为背景遮罩层,另一个作为提示信息框,实现了页面局部加载时的数据处理提示效果。
610

被折叠的 条评论
为什么被折叠?



