function function1() {
document.getElementById("progress1");
progress1.value -= 25
}
function gameOver() {
if (document.getElementById("progress1").getAttribute("value") === 0) {
alert("GameOver")
}else {
}
}
gameOver();
<button onclick="function1()" id="button1">Click Me !</button>
<progress id="progress1" value="50" max="100"></progress>
我想在bar值为0但不响应时运行
gameOver
函数 最佳答案
function function1() {
document.getElementById("progress1");
progress1.value -= 25
if (progress1.value === 0) {
alert("GameOver")
} else {}
}
<button onclick="function1()" id="button1">Click Me !</button>
<progress id="progress1" value="50" max="100"></progress>