如果一个页面的数据加载量很大,客户很难辨别页面是否加载完成,就会去点击上面的链接,导致误以为链接失效。 这时,我们需要一个遮罩层,来判断页面是否加载完成,如果没有加载完成,则不能对加载中的页面进行操作。
代码如下:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'MyJsp.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<script type="text/javascript" src="<%=basePath%>resources/plugins/cover/cover.js"></script>
function search(){
//表单中的查询方法
this.cover();//打开遮罩层
//执行查询
}
</head>
<body>
This is my JSP page. <br>
</body>
<script type="text/javascript" >
this.closeCover();//页面加载完成 关闭遮罩层
</script>
</html>