Is there a way to modify the JavaScript code for my progress bar that loads from 1 to 100 percent so that it automatically redirects to another page when reaching 100%? Here is the current JavaScript code:
var i = 0;
function move() {
if (i == 0) {
i = 1;
var elem = document.getElementById("mybar");
var width = 1;
var id = setInterval(frame, 10);
function frame() {
if (width >= 100) {
clearInterval(id);
i = 0;
// Add code to redirect to another page here
} else {
width++;
elem.style.width = width + "%";
elem.style.delay = "3s";
}
}
}
}