Looking for help implementing a progress bar in ASP
-
I am seeing the alert textbox, but my progress bar does not increment, can anyone tell me what I've done wrong? The static value does work. Thanks
<asp:FileUpload ID="thefile" runat="server" onchange="readURL(this);fill_out_filesize(this.files[0].size);progressBar();" itemid="thefile" value="thefile" Width="347px" />
function progressBar() {
//$("#progressbar").progressbar({
// value: 37
//});
alert("test");
var variable = 1;
var result = 0;
do {
result = ++variable
$("#progressbar").progressbar({
value: result
});
sleepFor(2000);
} while (true);
}function sleepFor(sleepDuration) {
var now = new Date().getTime();
while (new Date().getTime() < now + sleepDuration) { /* do nothing */ }
} -
I am seeing the alert textbox, but my progress bar does not increment, can anyone tell me what I've done wrong? The static value does work. Thanks
<asp:FileUpload ID="thefile" runat="server" onchange="readURL(this);fill_out_filesize(this.files[0].size);progressBar();" itemid="thefile" value="thefile" Width="347px" />
function progressBar() {
//$("#progressbar").progressbar({
// value: 37
//});
alert("test");
var variable = 1;
var result = 0;
do {
result = ++variable
$("#progressbar").progressbar({
value: result
});
sleepFor(2000);
} while (true);
}function sleepFor(sleepDuration) {
var now = new Date().getTime();
while (new Date().getTime() < now + sleepDuration) { /* do nothing */ }
}This is exactly what I want, only I am not sure how to implement into my code and where? I've tried and done so unsuccessfully because it is still not working Edit fiddle - JSFiddle[^]
-
This is exactly what I want, only I am not sure how to implement into my code and where? I've tried and done so unsuccessfully because it is still not working Edit fiddle - JSFiddle[^]
<h2>Dynamic Progress Bar</h2> <div class="w3-progress-container"> <div id="myBar" class="w3-progressbar w3-green" style="width:1%"></div> </div> <br> <button class="w3-btn w3-dark-grey" onclick="move()">Click Me</button> <script> function move() { var elem = document.getElementById("myBar"); var width = 1; var id = setInterval(frame, 10); function frame() { if (width >= 100) { clearInterval(id); } else { width++; elem.style.width = width + '%'; } } } </script>
trust mauchaza #facebook