添加:js测试 关闭窗口按钮 打开窗口按钮 运算测试
This commit is contained in:
+3
-5
@@ -10,14 +10,12 @@ button {
|
|||||||
height: 3em;
|
height: 3em;
|
||||||
color: rgb(255, 255, 255);
|
color: rgb(255, 255, 255);
|
||||||
background-color: rgb(240, 120, 24);
|
background-color: rgb(240, 120, 24);
|
||||||
|
display: block;
|
||||||
|
margin: 0 auto;
|
||||||
|
margin-top: 2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
button:hover {
|
button:hover {
|
||||||
color: rgb(240, 120, 24);
|
color: rgb(240, 120, 24);
|
||||||
background-color: rgb(255, 255, 255);
|
background-color: rgb(255, 255, 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
#click_button {
|
|
||||||
display: block;
|
|
||||||
margin: 16em auto;
|
|
||||||
}
|
|
||||||
|
|||||||
+3
-1
@@ -8,6 +8,8 @@
|
|||||||
<title>js测试</title>
|
<title>js测试</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<button id="click_button">点我弹窗</button>
|
<button id="alert_button">点我弹窗</button>
|
||||||
|
<button id="close_button">点我关闭窗口</button>
|
||||||
|
<button id="open_button">点我打开窗口</button>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
+17
-2
@@ -1,7 +1,22 @@
|
|||||||
alert('测试');
|
alert('测试');
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
const button = document.getElementById("click_button");
|
const alert_button = document.getElementById("alert_button");
|
||||||
button.addEventListener("click", function () {
|
alert_button.addEventListener("click", function () {
|
||||||
alert("你还真按啊");
|
alert("你还真按啊");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
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);
|
||||||
Reference in New Issue
Block a user