1
Hello I would like a help, I have a button that when pressed triggers the event of progressbar
and it starts loading up to 100%, after that I would like to open a page (for example thanks). HTML and Script are just below;
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 + '%';
}
}
}
<html>
<style>
#myProgress {
width: 100%;
background-color: #ddd;
}
#myBar {
width: 1%;
height: 30px;
background-color: #4CAF50;
}
</style>
<body>
<h1>ProgressBar com JavaScript </h1>
<div id="myProgress">
<div id="myBar"></div>
</div>
<br>
<button onclick="move()">Finalizar</button>
You have already done the check when it reaches 100, just open the window there. What was the difficulty?
– Woss