Files
ClassContent/历届学生/逯帅帅/每日课程/2021-03-05/index.html
2024-09-27 02:06:13 +08:00

45 lines
967 B
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>事件</title>
<style>
.none {
width: 200px;
}
</style>
</head>
<body>
<!-- <button onclick="test()">点我</button> -->
<button>点我</button>
</body>
<script>
// 事件 在浏览器中的某些(一堆类型)动作就是事件
// 1 事件源 2事件类型 3事件处理逻辑
var button = document.querySelector("button")
console.log(button);
// function tests () {
// alert(1)
// }
button.onclick = function () {
button.classList.toggle("none")
}
// button.addEventListener('click', function() {
// alert("111")
// })
// button.addEventListener('click', function() {
// alert("222")
// })
</script>
</html>