Use progress element and update the value in your timer
<progress id="progress" value="50" max="100"></progress>
document.getElementById(“progress”).value = (5-seconds) * 20;
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
How can I create a progress bar that will be loading, and after it finishes loading, it will automatically redirect to next page after 10 seconds?
Here is what I tried, although what I've been able to get is a button such that when the button is clicked, it starts counting and then redirects to another page
I want to create progress bar that will be loading and once it finishes loading, it redirects to another page, using C#
thank you.
HTML
<form id="form1" runat="server" style="background-image: src()">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<div style="z-index: 1; left: 15px; top: 18px; position: absolute; height: 63px; width: 284px">
<input type="button" value="Redirect to another Page" onclick="RedirectAfterDelayFn()" style="border-width: thick; border-style: double; background-color: #FFFFFF; height: 40px; width: 215px;" />
<br />
<br />
<div id="CountDown" style="display: none">
You will be redirected after
<br />
<span id="CountDownLabel"></span> seconds.
</div>
</div>
</form>
JavaScript
<script type="text/javascript">
function RedirectAfterDelayFn() {
var seconds = 5;
var dvCountDown = document.getElementById("CountDown");
var lblCount = document.getElementById("CountDownLabel");
dvCountDown.style.display = "block";
lblCount.innerHTML = seconds;
setInterval(function () {
seconds--;
lblCount.innerHTML = seconds;
if (seconds == 0) {
dvCountDown.style.display = "none";
window.location = "Home.aspx";
}
}, 1000);
}
</script>
Use progress element and update the value in your timer
<progress id="progress" value="50" max="100"></progress>
document.getElementById(“progress”).value = (5-seconds) * 20;