This commit is contained in:
rou
2026-03-23 14:56:04 +08:00
parent 00d3c9e4c6
commit 1071f4db05
27 changed files with 549 additions and 50 deletions

View File

@@ -4,3 +4,26 @@ let count = 0;
// 1. 获取数字元素和 3 个按钮
// 2. 点击按钮时更新 count
// 3. 每次修改后,把最新 count 渲染到页面
const num = document.getElementById("value")
const del = document.getElementById("decrease-btn")
const add = document.getElementById("increase-btn")
const reset = document.getElementById("reset-btn")
function ren() {
num.textContent = count
}
add.addEventListener("click", function () {
count++
ren()
})
del.addEventListener("click", function () {
count--
ren()
})
reset.addEventListener("click", function () {
count = 0
ren()
})