页面打开滚动条
建立Htm文件(文件名:progressbar.htm)
 <script language="javascript">
<script language="javascript"> 

 function setPgb(pgbID, pgbValue)
function setPgb(pgbID, pgbValue) 
 {
{ 
 if ( pgbValue <= 100 )
    if ( pgbValue <= 100 ) 
 {
    { 
 //debugger;
        //debugger;
 if (lblObj = document.getElementById(pgbID+'_label'))
        if (lblObj = document.getElementById(pgbID+'_label')) 
 {
        { 
 lblObj.innerHTML = pgbValue + '%'; // change the label value
            lblObj.innerHTML = pgbValue + '%'; // change the label value 
 }
        } 
 if ( pgbObj = document.getElementById(pgbID) )
        if ( pgbObj = document.getElementById(pgbID) ) 
 {
        { 
 var divChild = pgbObj.children[0];
            var divChild = pgbObj.children[0]; 
 pgbObj.children[0].style.width = pgbValue + "%";
            pgbObj.children[0].style.width = pgbValue + "%"; 
 }
        } 
 window.status = "数据读取" + pgbValue + "%,请稍候
        window.status = "数据读取" + pgbValue + "%,请稍候 ";
"; 
 }
    } 
 if ( pgbValue == 100 )
    if ( pgbValue == 100 ) 
 {
    {
 window.status = "数据读取已经完成";
        window.status = "数据读取已经完成"; 
 proBar.style.display="none";
        proBar.style.display="none";
 Table1.style.display="none";
        Table1.style.display="none";
 }
    }
 }
} 

 </script>
</script>
 <html>
<html>
 <head>
    <head>
 <link rel="stylesheet" type="text/css" href="common.css" />
        <link rel="stylesheet" type="text/css" href="common.css" />
 </head>
    </head>
 <body topmargin="0" leftmargin="0">
    <body topmargin="0" leftmargin="0">
 <table width="100%" height="100%" ID="Table1" runat=server>
        <table width="100%" height="100%" ID="Table1" runat=server>
 <tr>
            <tr>
 <td align="center" valign="middle">
                <td align="center" valign="middle">
 <DIV class="bi-loading-status" id="proBar" style="DISPLAY: ; LEFT: 425px; TOP: 278px">
                    <DIV class="bi-loading-status" id="proBar" style="DISPLAY: ; LEFT: 425px; TOP: 278px">
 <DIV class="text" id="pgbMain_label" align="left"></DIV>
                        <DIV class="text" id="pgbMain_label" align="left"></DIV>
 <DIV class="progress-bar" id="pgbMain" align="left">
                        <DIV class="progress-bar" id="pgbMain" align="left">
 <DIV STYLE="WIDTH:10%"></DIV>
                            <DIV STYLE="WIDTH:10%"></DIV>
 </DIV>
                        </DIV>
 </DIV>
                    </DIV>
 </td>
                </td>
 </tr>
            </tr>
 </table>
        </table>
 </body>
    </body>
 </html>
</html>
 用到的Css文件如下(common.css):
用到的Css文件如下(common.css):
 .bi-loading-status {
.bi-loading-status { 
 /*position: absolute;*/
/*position: absolute;*/ 
 width: 150px;
width: 150px; 
 padding: 1px;
padding: 1px; 
 overflow: hidden;
overflow: hidden; 
 }
} 
 .bi-loading-status .text {
.bi-loading-status .text { 
 white-space: nowrap;
white-space: nowrap; 
 overflow: hidden;
overflow: hidden; 
 width: 100%;
width: 100%; 
 text-overflow: ellipsis;
text-overflow: ellipsis; 
 padding: 1px;
padding: 1px; 
 }
} 
 .bi-loading-status .progress-bar {
.bi-loading-status .progress-bar { 
 border: 1px solid ThreeDShadow;
border: 1px solid ThreeDShadow; 
 background: window;
background: window; 
 height: 10px;
height: 10px; 
 width: 100%;
width: 100%; 
 padding: 1px;
padding: 1px; 
 overflow: hidden;
overflow: hidden; 
 }
} 
 .bi-loading-status .progress-bar div {
.bi-loading-status .progress-bar div { 
 background: Highlight;
background: Highlight; 
 overflow: hidden;
overflow: hidden; 
 height: 100%;
height: 100%; 
 filter: Alpha(Opacity=0, FinishOpacity=100, Style=1, StartX=0, StartY=0, FinishX=100, FinishY=0);
filter: Alpha(Opacity=0, FinishOpacity=100, Style=1, StartX=0, StartY=0, FinishX=100, FinishY=0); 
 }
} 
HTML (WebForm1.aspx)代码:
 <%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="WebApplication3.WebForm1" %>
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="WebApplication3.WebForm1" %>
 <HTML>
<HTML>
 <HEAD>
    <HEAD>
 <title>progressbar</title>
        <title>progressbar</title>
 <META http-equiv="Content-Type" content="text/html; charset=gb2312">
        <META http-equiv="Content-Type" content="text/html; charset=gb2312">
 <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
        <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
 <meta name="CODE_LANGUAGE" Content="C#">
        <meta name="CODE_LANGUAGE" Content="C#">
 <meta name="vs_defaultClientScript" content="JavaScript">
        <meta name="vs_defaultClientScript" content="JavaScript">
 <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
        <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
 </HEAD>
    </HEAD>
 <body MS_POSITIONING="GridLayout">
    <body MS_POSITIONING="GridLayout">
 <form id="Form1" method="post" runat="server">
        <form id="Form1" method="post" runat="server">
 <%=fixedHeader()%>
            <%=fixedHeader()%>
 </form>
        </form>
 </body>
    </body>
 </HTML>
</HTML>
 .Net 代码(WebForm1.aspx.cs):
.Net 代码(WebForm1.aspx.cs):
引用如下:
 using System;
using System;
 using System.Collections;
using System.Collections;
 using System.ComponentModel;
using System.ComponentModel;
 using System.Data;
using System.Data;
 using System.Drawing;
using System.Drawing;
 using System.Web;
using System.Web;
 using System.Web.SessionState;
using System.Web.SessionState;
 using System.Web.UI;
using System.Web.UI;
 using System.Web.UI.WebControls;
using System.Web.UI.WebControls;
 using System.Web.UI.HtmlControls;
using System.Web.UI.HtmlControls;
 using System.Threading;
using System.Threading;
 using System.IO;
using System.IO;
 using System.Text;
Page_Load事件里面代码:
using System.Text;
Page_Load事件里面代码:
 Page_Load
其中
Page_Load
其中
 Thread thread = new Thread(new ThreadStart(ThreadProc));
    Thread thread = new Thread(new ThreadStart(ThreadProc)); 
 thread.Start(); 
是开始线裎
                thread.Start(); 
是开始线裎
调用以下方法fixedProc():
 ThreadProc
ThreadProc
WebForm1.aspx里面调用的HTML代码:
 fixedHeader
    fixedHeader
方法LoadData():
 LoadData
LoadData
代码下载地址:
https://files.cnblogs.com/jhtchina/progressbar.rar
 <script language="javascript">
<script language="javascript"> 
 function setPgb(pgbID, pgbValue)
function setPgb(pgbID, pgbValue)  {
{  if ( pgbValue <= 100 )
    if ( pgbValue <= 100 )  {
    {  //debugger;
        //debugger; if (lblObj = document.getElementById(pgbID+'_label'))
        if (lblObj = document.getElementById(pgbID+'_label'))  {
        {  lblObj.innerHTML = pgbValue + '%'; // change the label value
            lblObj.innerHTML = pgbValue + '%'; // change the label value  }
        }  if ( pgbObj = document.getElementById(pgbID) )
        if ( pgbObj = document.getElementById(pgbID) )  {
        {  var divChild = pgbObj.children[0];
            var divChild = pgbObj.children[0];  pgbObj.children[0].style.width = pgbValue + "%";
            pgbObj.children[0].style.width = pgbValue + "%";  }
        }  window.status = "数据读取" + pgbValue + "%,请稍候
        window.status = "数据读取" + pgbValue + "%,请稍候 ";
";  }
    }  if ( pgbValue == 100 )
    if ( pgbValue == 100 )  {
    { window.status = "数据读取已经完成";
        window.status = "数据读取已经完成";  proBar.style.display="none";
        proBar.style.display="none"; Table1.style.display="none";
        Table1.style.display="none"; }
    } }
} 
 </script>
</script> <html>
<html> <head>
    <head> <link rel="stylesheet" type="text/css" href="common.css" />
        <link rel="stylesheet" type="text/css" href="common.css" /> </head>
    </head> <body topmargin="0" leftmargin="0">
    <body topmargin="0" leftmargin="0"> <table width="100%" height="100%" ID="Table1" runat=server>
        <table width="100%" height="100%" ID="Table1" runat=server> <tr>
            <tr> <td align="center" valign="middle">
                <td align="center" valign="middle"> <DIV class="bi-loading-status" id="proBar" style="DISPLAY: ; LEFT: 425px; TOP: 278px">
                    <DIV class="bi-loading-status" id="proBar" style="DISPLAY: ; LEFT: 425px; TOP: 278px"> <DIV class="text" id="pgbMain_label" align="left"></DIV>
                        <DIV class="text" id="pgbMain_label" align="left"></DIV> <DIV class="progress-bar" id="pgbMain" align="left">
                        <DIV class="progress-bar" id="pgbMain" align="left"> <DIV STYLE="WIDTH:10%"></DIV>
                            <DIV STYLE="WIDTH:10%"></DIV> </DIV>
                        </DIV> </DIV>
                    </DIV> </td>
                </td> </tr>
            </tr> </table>
        </table> </body>
    </body> </html>
</html>
 .bi-loading-status {
.bi-loading-status {  /*position: absolute;*/
/*position: absolute;*/  width: 150px;
width: 150px;  padding: 1px;
padding: 1px;  overflow: hidden;
overflow: hidden;  }
}  .bi-loading-status .text {
.bi-loading-status .text {  white-space: nowrap;
white-space: nowrap;  overflow: hidden;
overflow: hidden;  width: 100%;
width: 100%;  text-overflow: ellipsis;
text-overflow: ellipsis;  padding: 1px;
padding: 1px;  }
}  .bi-loading-status .progress-bar {
.bi-loading-status .progress-bar {  border: 1px solid ThreeDShadow;
border: 1px solid ThreeDShadow;  background: window;
background: window;  height: 10px;
height: 10px;  width: 100%;
width: 100%;  padding: 1px;
padding: 1px;  overflow: hidden;
overflow: hidden;  }
}  .bi-loading-status .progress-bar div {
.bi-loading-status .progress-bar div {  background: Highlight;
background: Highlight;  overflow: hidden;
overflow: hidden;  height: 100%;
height: 100%;  filter: Alpha(Opacity=0, FinishOpacity=100, Style=1, StartX=0, StartY=0, FinishX=100, FinishY=0);
filter: Alpha(Opacity=0, FinishOpacity=100, Style=1, StartX=0, StartY=0, FinishX=100, FinishY=0);  }
} HTML (WebForm1.aspx)代码:
 <%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="WebApplication3.WebForm1" %>
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="WebApplication3.WebForm1" %> <HTML>
<HTML> <HEAD>
    <HEAD> <title>progressbar</title>
        <title>progressbar</title> <META http-equiv="Content-Type" content="text/html; charset=gb2312">
        <META http-equiv="Content-Type" content="text/html; charset=gb2312"> <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
        <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1"> <meta name="CODE_LANGUAGE" Content="C#">
        <meta name="CODE_LANGUAGE" Content="C#"> <meta name="vs_defaultClientScript" content="JavaScript">
        <meta name="vs_defaultClientScript" content="JavaScript"> <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
        <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> </HEAD>
    </HEAD> <body MS_POSITIONING="GridLayout">
    <body MS_POSITIONING="GridLayout"> <form id="Form1" method="post" runat="server">
        <form id="Form1" method="post" runat="server"> <%=fixedHeader()%>
            <%=fixedHeader()%> </form>
        </form> </body>
    </body> </HTML>
</HTML>
引用如下:
 using System;
using System; using System.Collections;
using System.Collections; using System.ComponentModel;
using System.ComponentModel; using System.Data;
using System.Data; using System.Drawing;
using System.Drawing; using System.Web;
using System.Web; using System.Web.SessionState;
using System.Web.SessionState; using System.Web.UI;
using System.Web.UI; using System.Web.UI.WebControls;
using System.Web.UI.WebControls; using System.Web.UI.HtmlControls;
using System.Web.UI.HtmlControls; using System.Threading;
using System.Threading; using System.IO;
using System.IO; using System.Text;
using System.Text; Page_Load
Page_Load Thread thread = new Thread(new ThreadStart(ThreadProc));
    Thread thread = new Thread(new ThreadStart(ThreadProc));  thread.Start();
                thread.Start(); 调用以下方法fixedProc():
 ThreadProc
ThreadProcWebForm1.aspx里面调用的HTML代码:
 fixedHeader
    fixedHeader方法LoadData():
 LoadData
LoadData代码下载地址:
https://files.cnblogs.com/jhtchina/progressbar.rar
 
                    
                
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号