From 86f2e26b4ec2c972faabb4c132c5eb54971acb4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=A1=E5=9D=82=E6=98=B4?= Date: Wed, 5 Mar 2025 11:28:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=EF=BC=9Ajs=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=20=E5=85=B3=E9=97=AD=E7=AA=97=E5=8F=A3=E6=8C=89=E9=92=AE=20?= =?UTF-8?q?=E6=89=93=E5=BC=80=E7=AA=97=E5=8F=A3=E6=8C=89=E9=92=AE=20?= =?UTF-8?q?=E8=BF=90=E7=AE=97=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/js/index.css | 8 +++----- test/js/index.html | 4 +++- test/js/index.js | 21 ++++++++++++++++++--- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/test/js/index.css b/test/js/index.css index 3b52518..e9980b8 100644 --- a/test/js/index.css +++ b/test/js/index.css @@ -10,14 +10,12 @@ button { height: 3em; color: rgb(255, 255, 255); background-color: rgb(240, 120, 24); + display: block; + margin: 0 auto; + margin-top: 2em; } button:hover { color: rgb(240, 120, 24); background-color: rgb(255, 255, 255); } - -#click_button { - display: block; - margin: 16em auto; -} diff --git a/test/js/index.html b/test/js/index.html index b81054a..4d9b8b4 100644 --- a/test/js/index.html +++ b/test/js/index.html @@ -8,6 +8,8 @@ js测试 - + + + diff --git a/test/js/index.js b/test/js/index.js index 907350b..c97c313 100644 --- a/test/js/index.js +++ b/test/js/index.js @@ -1,7 +1,22 @@ alert('测试'); + document.addEventListener("DOMContentLoaded", function () { - const button = document.getElementById("click_button"); - button.addEventListener("click", function () { + const alert_button = document.getElementById("alert_button"); + alert_button.addEventListener("click", function () { alert("你还真按啊"); }); -}); \ No newline at end of file + + const close_button = document.getElementById("close_button"); + close_button.addEventListener("click", function () { + window.close(); + }); + + const open_button = document.getElementById("open_button"); + open_button.addEventListener("click", function () { + window.open(); + }); +}); + +var num1 = 1; +var num2 = 2; +console.log(num1 + num2); \ No newline at end of file