弹出一个遮罩层有正在加载效果的文字
发布时间:2014-04-17 16:44:36 作者:佚名 我要评论
弹出一个遮罩层有正在加载效果的文字,在很多场景都有看到过,下面为大家介绍下具体的实现
实现:
<!doctype html>
<html>
<head>
<title>遮罩层</title>
<meta charset="utf-8" />
<style>
#cover{
display:none;
position:fixed;
z-index:1;
top:0;
left:0;
width:100%;
height:100%;
background:rgba(0, 0, 0, 0.44);
}
#coverShow{
display:none;
position:fixed;
z-index:2;
top:50%;
left:50%;
border:1px solid #127386;
width:300px;
height:100px;
margin-left:-150px;
margin-top:-150px;
background:#127386;
}
</style>
<script>
function clickfunc()
{
alert("clicked, 遮住之前’测试‘按钮是起作用的");
}
function coverit()
{
var cover = document.getElementById("cover");
var covershow = document.getElementById("coverShow");
cover.style.display = 'block';
covershow.style.display = 'block';
alert("已经遮住,’测试‘按钮已经不起作用了");
}
</script>
</head>
<body>
<div id="cover"></div>
<div id="coverShow">
<table align="center" border="0" width="100%" cellspacing="0" cellpadding="0" style="border-collapse: collapse; height: 100px; min-height: 100px;" bgcolor="#127386">
<tr>
<td height="30" style="font-size: 12px;">正在加载,请稍后......</td>
</tr>
<tr>
<td align="center" bgcolor="#ffffff">
这里加载一个img src为动态的gif
</td>
</tr>
</table>
</div>
<div>
这里面是内容
<span>所有的内容都被cover遮住</span>
<div>
<font style="color:red">
两个遮罩层
<br/>
第一个遮罩层cover是将整个body盖住,width=100%,height=100%.
第二个遮罩层coverShow居中显示,可以在里面加载img元素。
</font>
</div>
<input type="button" value="测试" onclick="clickfunc()"/>
</div>
<input type="button" value="遮住" onclick="coverit()"/>
</body>
</html>
复制代码
代码如下:<!doctype html>
<html>
<head>
<title>遮罩层</title>
<meta charset="utf-8" />
<style>
#cover{
display:none;
position:fixed;
z-index:1;
top:0;
left:0;
width:100%;
height:100%;
background:rgba(0, 0, 0, 0.44);
}
#coverShow{
display:none;
position:fixed;
z-index:2;
top:50%;
left:50%;
border:1px solid #127386;
width:300px;
height:100px;
margin-left:-150px;
margin-top:-150px;
background:#127386;
}
</style>
<script>
function clickfunc()
{
alert("clicked, 遮住之前’测试‘按钮是起作用的");
}
function coverit()
{
var cover = document.getElementById("cover");
var covershow = document.getElementById("coverShow");
cover.style.display = 'block';
covershow.style.display = 'block';
alert("已经遮住,’测试‘按钮已经不起作用了");
}
</script>
</head>
<body>
<div id="cover"></div>
<div id="coverShow">
<table align="center" border="0" width="100%" cellspacing="0" cellpadding="0" style="border-collapse: collapse; height: 100px; min-height: 100px;" bgcolor="#127386">
<tr>
<td height="30" style="font-size: 12px;">正在加载,请稍后......</td>
</tr>
<tr>
<td align="center" bgcolor="#ffffff">
这里加载一个img src为动态的gif
</td>
</tr>
</table>
</div>
<div>
这里面是内容
<span>所有的内容都被cover遮住</span>
<div>
<font style="color:red">
两个遮罩层
<br/>
第一个遮罩层cover是将整个body盖住,width=100%,height=100%.
第二个遮罩层coverShow居中显示,可以在里面加载img元素。
</font>
</div>
<input type="button" value="测试" onclick="clickfunc()"/>
</div>
<input type="button" value="遮住" onclick="coverit()"/>
</body>
</html>
相关文章
- 这篇文章主要介绍了遮罩层 + Iframe实现界面自动显示的示例代码,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小2020-04-26
- 这篇文章主要为大家详细介绍了HTML实现遮罩层的方法,Web页面中使用遮罩层,可防止重复操作,那么如何在HTML中使用遮罩层?感兴趣的小伙伴们可以参考一下2016-03-25
- 今天有任务让加个蒙版,JS小白的我在网上找了个修改下,改成了JS模版以后可以重复用啦,本文将详细介绍DIV遮罩层如何实现,需要的 朋友可以参考下2012-11-20
- 背景半透明,覆盖整个可视区域的遮罩层效果在工作中经常会遇到,这篇文章主要介绍了当内容超过一屏时如何做到多浏览器的兼容性。 下面我们通过一个简单的例子看看如何实现2011-12-08
- 背景半透明,覆盖整个可视区域的遮罩层效果在工作中经常会遇到,这篇文章主要介绍了当内容超过一屏时如何做到多浏览器的兼容性。 下面我们通过一个简单的例子看看如何实现2011-10-30
- 这篇文章主要介绍了Html5页面点击遮罩层背景关闭遮罩层,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起2020-11-30
最新评论