添加:js测试 弹窗按钮
This commit is contained in:
@@ -2,3 +2,22 @@
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
button {
|
||||||
|
border: 2px;
|
||||||
|
border-style: solid;
|
||||||
|
border-color: rgb(240, 120, 24);
|
||||||
|
width: 8em;
|
||||||
|
height: 3em;
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
background-color: rgb(240, 120, 24);
|
||||||
|
}
|
||||||
|
|
||||||
|
button:hover {
|
||||||
|
color: rgb(240, 120, 24);
|
||||||
|
background-color: rgb(255, 255, 255);
|
||||||
|
}
|
||||||
|
|
||||||
|
#click_button {
|
||||||
|
display: block;
|
||||||
|
margin: 16em auto;
|
||||||
|
}
|
||||||
|
|||||||
+4
-2
@@ -4,8 +4,10 @@
|
|||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<link rel="stylesheet" href="index.css" />
|
<link rel="stylesheet" href="index.css" />
|
||||||
<link rel="text/javascript" href="index.js" />
|
<script src="index.js"></script>
|
||||||
<title>js测试</title>
|
<title>js测试</title>
|
||||||
</head>
|
</head>
|
||||||
<body></body>
|
<body>
|
||||||
|
<button id="click_button">点我弹窗</button>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
alert('测试');
|
||||||
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
|
const button = document.getElementById("click_button");
|
||||||
|
button.addEventListener("click", function () {
|
||||||
|
alert("你还真按啊");
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user