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,97 @@
<!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>
</head>
<body>
<button class="one">点我</button>
<button class="two" onclick="test()">哈哈哈</button>
<button class="three" >哈哈哈22333</button>
<a href="https://www.baidu.com/">百度</a>
</body>
<script>
// 事件
// 事件有三要素
// 事件源 事件类型 事件处理函数
// 事件冒泡
var a = document.querySelector(".one")
// a.innerHTML = "<span>你好</span>"
console.dir(a);
document.querySelector("a").onclick = function (e) {
// 阻止默认事件
e.preventDefault();
console.log("hahaah");
}
a.onclick = function (event) {
console.log(event);
alert("点我干什么1")
}
// function test() {
// alert("two")
// }
// document.querySelector(".three").addEventListener('click', function() {
// alert("哈哈哈1")
// })
// document.querySelector(".three").addEventListener('click', function() {
// alert("哈哈哈2")
// })
// var dom = {
// tagName: 'div',
// className: 'main',
// idName: null,
// children: [
// {
// tagName: 'h2',
// className: 'title',
// idName: null,
// children: [
// {
// tagName: 'img',
// className: null,
// idName: null,
// children: null
// }
// ]
// },
// {
// tagName: 'button',
// className: null,
// idName: null,
// children: [
// {
// tagName: '#text',
// className: null,
// idName: null,
// children: null
// }
// ]
// }
// ]
// }
// 虚拟domjs对象
// 影子dom
// 真实dom
</script>
</html>