简体   繁体   English

上传时显示进度条

[英]show progress bar while uploading

i'm trying to show the progress bar while uploading. 我正在尝试在上传时显示进度栏。 I have a gif image that has a class with the property display:none and on button click I switch the property to display: block using javascript. 我有一个gif图像,该图像具有一个类,其属性为display:none,然后单击按钮,将属性切换为display:block,使用javascript。

this is my function. 这是我的职责。

function showProgress() {

$('#uplImage').css('display','block')

}

this is the image class 这是图像类

.uplImage {
display: none;
margin-left: 100px;
z-index: 999;
position:absolute;
margin-top: -800px;
}

this is my button 这是我的按钮

<asp:Button ID="btnSubmit" runat="server" Text="Submit" CssClass="submit" 
Height="35px"
Width="100px" OnClick="btnSubmit_Click" OnClientClick="showProgress()"
ValidationGroup="validate" />

gif image doesn't show. gif图像不显示。

When pressing on asp button it would postback to the server side. 当按下asp按钮时,它将回发到服务器端。 So the thing is that you image does appear for a millisecond and then the postback is send 所以事情是您的图像确实出现了毫秒,然后发送回发

If you want to show an upload image while the file is uploading you need to use ajax. 如果要在文件上传时显示上传图像,则需要使用ajax。

If you want to show a progress bar, you need to post the files asynchronously using ajax. 如果要显示进度条,则需要使用ajax异步发布文件。 Right now you're simply posting the form back to the server, of course nothing shows up :) 现在,您只是将表单发布回服务器,当然什么也没显示:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM