VB.NET进度条的方法代码


1.创建进度条:

复制代码 代码如下:

<DIV id="Lay1" style="Z-INDEX: 1; LEFT: 1%; 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><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>

2.设置查询按钮属性
复制代码 代码如下:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'在此处放置初始化页的用户代码
If Not IsPostBack The
but_find.Attributes.Add("onClick", "Lay1.style.visibility='';progress_update();")
End If
End Sub

3.注册javascript脚本
复制代码 代码如下:

Public Sub scriptjdt(ByVal objPage As System.Web.UI.Page, ByVal strValue As String)
Dim jb As String
jb = "<script language='JavaScript'>" + strValue + "</script>"
objPage.RegisterStartupScript("jdt_ok", jb)
End Sub

4.在查询按钮单击事件中调用
复制代码 代码如下:

Private Sub but_find_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles but_find.Click
'查询数据代码
'----------------
Me.scriptjdt(Me, "Lay1.style.visibility='hidden';progress_stop();") '关闭进度条代码
End Sub



相关阅读:
两个select多选模式的选项相互移动(示例代码)
javascript实现表格排序 编辑 拖拽 缩放
在MySQL中使用子查询和标量子查询的基本操作教程
C++基础入门教程(六):为什么创建类的时候要用new?
Win8.1系统使用键盘快捷键浏览网页的方法
微软预览版如何转正?微软官方免费升级Windows 10正式版
C#线程池操作方法
Win10激活失败出现错误代码0xC004C003原因:微软服务器不堪重负
牛叉的Jquery——Jquery与DOM对象的互相转换及DOM的三种操作
C++智能指针实例详解
Android判断屏幕是横屏或是竖屏的简单实现方法
解决jquery插件:TypeError:$.browser is undefined报错的方法
AngularJS Bootstrap详细介绍及实例代码
ASP.NET中配合JS实现页面计时(定时)自动跳转
快速导航

Copyright © 2016 phpStudy | 皖ICP备18014864号-4