页面在加载时,等时候的页面(loading……)
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="Musi.进度条页面.WebForm1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="../Js/jquery-1.4.1.js" type="text/javascript"></script>
<script src="../Js/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
<script language="JavaScript" type="text/javascript">
<script language="JavaScript" type="text/javascript">
var t_id = setInterval(animate, 20);
var pos = 0; var dir = 2; var len = 0;
function animate() {
var elem = document.getElementById('progress');
if (elem != null) {
if (pos == 0) len += dir;
if (len > 32 || pos > 79) pos += dir;
if (pos > 79) len -= dir;
if (pos > 79 && len == 0) pos = 0;
elem.style.left = pos;
elem.style.width = len;
}
}
function remove_loading() {
this.clearInterval(t_id);
var targelem = document.getElementById('loader_container');
targelem.style.display = 'none';
targelem.style.visibility = 'hidden';
}
function hideLoading() {
// $("#btnOk").removeAttr("disabled");
$("#loader_container").css("display", "none");
return true;
}
function show() {
$("#loader_container").css("display", "block");
return true;
}
</script>
<style type="text/css">
#loader_container
{
float: left;
left: 532px;
text-align: center;
position: absolute;
top: 300px;
width: 12%;
height: 53px;
}
#loader
{
font-family: Tahoma, Helvetica, sans;
font-size: 11.5px;
color: #000000;
background-color: #FFFFFF;
padding: 10px 0 16px 0;
margin: 0 auto;
display: block;
width: 130px;
border: 1px solid #5a667b;
text-align: left;
z-index: 2;
height: 26px;
}
#progress
{
height: 5px;
font-size: 1px;
width: 1px;
position: relative;
top: 1px;
left: 0px;
background-color: #8894a8;
}
#loader_bg
{
background-color: #e4e7eb;
position: relative;
top: 8px;
left: 8px;
height: 7px;
width: 113px;
font-size: 1px;
}
#load
{
top: 300px;
left: 500px;
}
</style>
</head>
<body onload="hideLoading()">
<form id="form1" runat="server">
<div style="text-align: center;">
<div id="loader_container">
<div id="loader">
<div style="text-align: center;">
页面正在加载中 ...</div>
<div id="loader_bg">
<div id="progress">
</div>
</div>
</div>
</div>
<div style="top: 400px; height: 539px;">
<input id="Button2" type="button" value="button" onclick="show()" />
<asp:Button ID="btnOk" runat="server" OnClientClick="show()" OnClick="Button1_Click"
Text="Button" />
</div>
</div>
</form>
</body>
</html>
这是页面也加载效果,比我上回写的那个要好些,这些我后来改进的。
protected void Button1_Click(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(2000);
}