<html>
<body>
<p>单击按钮执行循环,将跳过数字 2 和 3。</p>
<button onclick="myFunction()">试一试</button>
<p id="demo"></p>
<script>
function myFunction() {
var text = "";
var i;
for (i = 1; i < 8; i++) {
if (i === 2 || i === 3) continue;
document.getElementById("demo").innerHTML += i + "<br>";
}
}
</script>
</body>
</html>