first commit

This commit is contained in:
编码猿
2024-09-27 02:06:13 +08:00
commit 852d94fbb9
36760 changed files with 3274413 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>js 事件</title>
</head>
<body>
<!-- <button onclick="buttonClick()" >点我</button> -->
<button>点我</button>
<script>
// 第一种定义事件的方法
// 不好的地方:
// function buttonClick() {
// alert("不要点我")
// }
// 第二种定义事件的方法
//
// document.querySelector("button").onclick = function () {
// document.querySelector("button").innerText = "不要点我1";
// }
// 第三种定义事件的方法
// document.querySelector("button").addEventListener("click",function(){
// alert(1)
// })
// document.querySelector("button").addEventListener("click",function(){
// alert(2)
// })
// 使用js获取元素的几种方法
// document.getElementById
// document.getElementsByClassName
// document.getElementsByTagName
// document.getElementsByName
// document.querySelector(".name p");
// document.querySelectorAll(".name p");
</script>
</body>
</html>