html页面中js添加遮盖层实现等待效果
2015-07-03 17:34
627 查看
<html>
<head>
<title>遮罩层</title>
<meta charset="gb2312" />
<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 coverit()
{
var cover = document.getElementById("cover");
var covershow = document.getElementById("coverShow");
cover.style.display = 'block';
covershow.style.display = 'block';
setTimeout("showTime()",3000);
}
function showTime(){
var cover = document.getElementById("cover");
var covershow = document.getElementById("coverShow");
cover.style.display = '';
covershow.style.display = '';
}
</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="ajax-loader.gif"/>
</td>
</tr>
</table>
</div>
<input type="button" value="遮住" onclick="coverit()"/>
</body>
<html>
<head>
<title>遮罩层</title>
<meta charset="gb2312" />
<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 coverit()
{
var cover = document.getElementById("cover");
var covershow = document.getElementById("coverShow");
cover.style.display = 'block';
covershow.style.display = 'block';
setTimeout("showTime()",3000);
}
function showTime(){
var cover = document.getElementById("cover");
var covershow = document.getElementById("coverShow");
cover.style.display = '';
covershow.style.display = '';
}
</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="ajax-loader.gif"/>
</td>
</tr>
</table>
</div>
<input type="button" value="遮住" onclick="coverit()"/>
</body>
<html>
相关文章推荐
- 第三章 javaScript数据类型
- javascript获取系统当前时间
- js作用域的学习
- js定时跳转页面
- web扫描工具-Jsky使用
- JavaScript事件
- JS设计模式一:单例模式
- Java和JavaScript中使用Json方法大全
- Js极客之路 - 简化操作
- cJSON源码里的例子
- Cordova 2 基本使用 添加其它js框架
- 编写JSP文件时修改默认网页编码
- Extjs4布局layout
- javascript arguments(转)
- js预载入和JavaScript Image()对象使用介绍
- widget.html调用widget.js中的方法
- jsp界面中不识别EL表达式
- js控制input type=checkbox 的勾选
- javascript——单例模式
- JS line-height是做什么的?