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