会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
夏楚枫
博客园
首页
新随笔
联系
订阅
管理
(转)页面加载时间进度条
一、前台代码
<
DIV
id
="Lay1"
style
="Z-INDEX: 101; LEFT: 0.92%; VISIBILITY: hidden; WIDTH: 99%; CURSOR: crosshair; POSITION: absolute; TOP: 32px; HEIGHT: 95%; BACKGROUND-COLOR: #ffffff"
><
FONT
face
="宋体"
></
FONT
><
FONT
face
="宋体"
></
FONT
><
FONT
face
="宋体"
></
FONT
><
FONT
face
="宋体"
></
FONT
><
FONT
face
="宋体"
></
FONT
><
FONT
face
="宋体"
></
FONT
><
FONT
face
="宋体"
></
FONT
><
FONT
face
="宋体"
></
FONT
><
FONT
face
="宋体"
></
FONT
><
FONT
face
="宋体"
></
FONT
><
FONT
face
="宋体"
></
FONT
><
FONT
face
="宋体"
></
FONT
><
FONT
face
="宋体"
></
FONT
><
br
>
<
b
><
font
color
="#800080"
size
="2"
>
& nbsp;
正在检索数据,请稍候
</
font
></
b
>
<
table
align
="center"
>
<
tr
>
<
td
>
<
div
style
="BORDER-RIGHT: black 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: black 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 8pt; PADDING-BOTTOM: 2px; BORDER-LEFT: black 1px solid; PADDING-TOP: 2px; BORDER-BOTTOM: black 1px solid"
><
span
id
="progress1"
>
</
span
>
<
span
id
="progress2"
>
</
span
>
<
span
id
="progress3"
>
</
span
>
<
span
id
="progress4"
>
</
span
>
<
span
id
="progress5"
>
</
span
>
<
span
id
="progress6"
>
</
span
>
<
span
id
="progress7"
>
</
span
>
<
span
id
="progress8"
>
</
span
>
<
span
id
="progress9"
>
</
span
>
<
span
id
="progress10"
>
</
span
>
<
span
id
="progress11"
>
</
span
>
<
span
id
="progress12"
>
</
span
>
<
span
id
="progress13"
>
</
span
><
span
id
="progress14"
>
</
span
><
span
id
="progress15"
>
</
span
>
</
div
>
</
td
>
</
tr
>
</
table
>
<
script
language
="javascript"
>
var
progressEnd
=
15
;
//
set to number of progress <span>'s.
var
progressColor
=
'
blue
'
;
//
set to progress bar color
var
progressInterval
=
300
;
//
set to time between updates (milli-seconds)
var
progressAt
=
progressEnd;
var
progressTimer;
function
progress_clear()
{
for
(
var
i
=
1
; i
<=
progressEnd; i
++
) document.getElementById(
'
progress
'
+
i).style.backgroundColor
=
'
transparent
'
;
progressAt
=
0
;
}
function
progress_update()
{
progressAt
++
;
if
(progressAt
>
progressEnd) progress_clear();
else
document.getElementById(
'
progress
'
+
progressAt).style.backgroundColor
=
progressColor;
progressTimer
=
setTimeout(
'
progress_update()
'
,progressInterval);
}
function
progress_stop()
{
clearTimeout(progressTimer);
progress_clear();
}
//
progress_update(); // start progress bar
</
script
>
</
DIV
>
<
asp:Button
id
="but_find"
style
="Z-INDEX: 102; LEFT: 160px; POSITION: absolute; TOP: 0px"
runat
="server"
Text
="查询"
Width
="120px"
></
asp:Button
>
二、.cs代码:
private
void
Page_Load(
object
sender, System.EventArgs e)
{
if
(
!
IsPostBack)
{
but_find.Attributes.Add(
"
onClick
"
,
"
Lay1.style.visibility='';progress_update();
"
);
}
}
public
void
scriptjdt(System.Web.UI.Page objPage ,
string
strValue )
{
string
jb ;
jb
=
"
<script language='JavaScript'>
"
+
strValue
+
"
</script>
"
;
objPage.RegisterStartupScript(
"
jdt_ok
"
, jb);
}
Web 窗体设计器生成的代码
#region
Web 窗体设计器生成的代码
override
protected
void
OnInit(EventArgs e)
{
//
//
CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base
.OnInit(e);
}
/**/
///
<summary>
///
设计器支持所需的方法 - 不要使用代码编辑器修改
///
此方法的内容。
///
</summary>
private
void
InitializeComponent()
{
this
.but_find.Click
+=
new
System.EventHandler(
this
.but_find_Click);
this
.Load
+=
new
System.EventHandler(
this
.Page_Load); }
#endregion
private
void
but_find_Click(
object
sender, System.EventArgs e)
{
this
.scriptjdt(
this
,
"
Lay1.style.visibility='hidden';progress_stop();
"
);
}
posted @
2010-08-31 19:36
你妹的sb
阅读(
481
) 评论(
0
)
收藏
举报
刷新页面
返回顶部
公告
百度一下