如何在使用javascript点击按钮时显示进度条? [英] how to show progressbar while clicking on button using javascript?
问题描述
helo朋友..
im在网站上工作,我已经使用jquery实现了进度条的代码,如下所示。但是我严重地陷入了困境,那就是当我我点击了asp按钮,它显示了我的进度条,但问题是它已启动然后它没有停止。我尝试了所有方法但没有得到解决方案。
请帮助我的朋友。紧急。
提前感谢。
我在jquery中写了以下代码:
function ShowProgress(){
setTimeout(function(){
var modal = $(' < div />');
modal.addClass( modal);
$(' body')。append(modal);
v ar loading = $( .loading);
loading.show();
var top = Math.max($(window).height()/ 2 - loading [ 0 ]。offsetHeight / 2 , 0 跨度>);
var left = Math.max($(window).width()/ 2 - loading [ 0 ]。offsetWidth / 2 , 0 跨度>);
loading.css({top:top,left:left});
}, 200 );
}
$(' form')。live( submit,function(){
ShowProgress();
});
$。b $ b。以下代码在.cs文件中
受保护 < span class =code-keyword> void btnLogin_Click( object sender,EventArgs e)
{
string script = $(document).ready(function(){$( '[id * = btnLogin]')。click();});;
ClientScript.RegisterStartupScript( this .GetType(), click,script, true );
int CurrentRoleID = 0 ;
System.Threading.Thread.Sleep( 1000 );
和.aspx页面文件:
< div class = 加载 align = center >
正在加载。请稍候。< br / >
< < span class =code-leadattribute> br / >
< img src = images /googleballs.gif\" alt = / >
< / div >
(' < div />');
modal.addClass( modal);
< blockquote>(' body')。append(modal);
var loading =
( 加载跨度>)。
loading.show();
var top = Math.max(
helo friends..
i m working on website in which i have implemented code for progressbar using jquery as shown below.but i stucked in it badly that is when i am clicking asp button ,its showing me progressbar but the problem is ones it is started and then it not stopping.i tried all ways but not getting the solution.
please help me friends .its urgent.
thanks in advance.
I have written the following code in jquery:
function ShowProgress() {
setTimeout(function () {
var modal = $('<div />');
modal.addClass("modal");
$('body').append(modal);
var loading = $(".loading");
loading.show();
var top = Math.max($(window).height() / 2 - loading[0].offsetHeight / 2, 0);
var left = Math.max($(window).width() / 2 - loading[0].offsetWidth / 2, 0);
loading.css({ top: top, left: left });
}, 200);
}
$('form').live("submit", function () {
ShowProgress();
});
following code in .cs file
protected void btnLogin_Click(object sender, EventArgs e)
{
string script = "$(document).ready(function () { $('[id*=btnLogin]').click(); });";
ClientScript.RegisterStartupScript(this.GetType(), "click", script, true);
int CurrentRoleID = 0;
System.Threading.Thread.Sleep(1000);
and in .aspx page file:
<div class="loading" align="center">
Loading. Please wait.<br />
<br />
<img src="images/googleballs.gif" alt="" />
</div>
('<div />'); modal.addClass("modal");
('body').append(modal); var loading =
(".loading"); loading.show(); var top = Math.max(
这篇关于如何在使用javascript点击按钮时显示进度条?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!