jsp显示页面加载时间

来源:互联网 发布:js动态添加class样式 编辑:程序博客网 时间:2024/06/10 03:03
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>页面加载时间</title>
<style type="text/css">
#out{width:300px;height:20px;background:#EEEEEE;}
#in{width:10px;height:20px;background:#0033FF;color:while;text-align:center;}
</style>
</head>
<body bgcolor="#FFFFCC" onload="start();">
<div id="out">
 <div id="in" style="width:10%">10%</div>
</div>
<script language="javascript">
i=0;
function start()
{
ba=setInterval("begin()", 100);
}
function begin()
{
i+=1;
if(i<=100)
{
document.getElementById("in").style.width=i+"%";
document.getElementById("in").innerHTML=i+"%";
}
else
{
clearInterval(ba);
document.getElementById("out").style.display="none";
document.write("<span style='background:#33CC00;text-align:center;color:while;'>加载成功</span>");
}
}
</script>
</body>
</html>
0 0
原创粉丝点击