Created
July 21, 2023 07:46
-
-
Save yehchge/0081d467b10429196516f9f74bb94e32 to your computer and use it in GitHub Desktop.
動態在網頁上顯示數字
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Dynamic Number Display</title> | |
</head> | |
<body> | |
<div id="numberDisplay"></div> | |
<script> | |
var count = 1; | |
function displayNumber() { | |
document.getElementById("numberDisplay").innerHTML = count; | |
count++; | |
if (count > 10) { | |
clearInterval(interval); | |
} | |
} | |
var interval = setInterval(displayNumber, 1000); // 每秒更新一次 | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment