From 3644a499029bf0c341e944852868e5afbf13fbec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=87=8C=E7=BF=94?= <963304364@qq.com> Date: Thu, 24 Nov 2022 08:45:53 +0000 Subject: [PATCH 01/11] =?UTF-8?q?=E6=96=B0=E5=BB=BA=20=E7=AC=AC=E4=BA=8C?= =?UTF-8?q?=E5=8D=81=E4=B8=80=E6=AC=A1=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../.keep" | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 "22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\272\214\345\215\201\344\270\200\346\254\241\344\275\234\344\270\232/.keep" diff --git "a/22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\272\214\345\215\201\344\270\200\346\254\241\344\275\234\344\270\232/.keep" "b/22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\272\214\345\215\201\344\270\200\346\254\241\344\275\234\344\270\232/.keep" new file mode 100644 index 0000000..e69de29 -- Gitee From e06ad21a94933d6a9c903694eb5633e6e0ae62c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=87=8C=E7=BF=94?= <963304364@qq.com> Date: Thu, 24 Nov 2022 08:46:00 +0000 Subject: [PATCH 02/11] =?UTF-8?q?=E6=96=B0=E5=BB=BA=20=E7=AC=94=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\347\254\224\350\256\260/.keep" | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 "22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\272\214\345\215\201\344\270\200\346\254\241\344\275\234\344\270\232/\347\254\224\350\256\260/.keep" diff --git "a/22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\272\214\345\215\201\344\270\200\346\254\241\344\275\234\344\270\232/\347\254\224\350\256\260/.keep" "b/22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\272\214\345\215\201\344\270\200\346\254\241\344\275\234\344\270\232/\347\254\224\350\256\260/.keep" new file mode 100644 index 0000000..e69de29 -- Gitee From 72995fdbbca8eed30b3941f240b7a4ff2b886de6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=87=8C=E7=BF=94?= <963304364@qq.com> Date: Thu, 24 Nov 2022 08:46:09 +0000 Subject: [PATCH 03/11] =?UTF-8?q?=E6=96=B0=E5=BB=BA=20=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\344\275\234\344\270\232/.keep" | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 "22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\272\214\345\215\201\344\270\200\346\254\241\344\275\234\344\270\232/\344\275\234\344\270\232/.keep" diff --git "a/22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\272\214\345\215\201\344\270\200\346\254\241\344\275\234\344\270\232/\344\275\234\344\270\232/.keep" "b/22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\272\214\345\215\201\344\270\200\346\254\241\344\275\234\344\270\232/\344\275\234\344\270\232/.keep" new file mode 100644 index 0000000..e69de29 -- Gitee From 004c75c5064ec86f7264d922324e827505c9d60d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=87=8C=E7=BF=94?= <963304364@qq.com> Date: Thu, 24 Nov 2022 08:46:34 +0000 Subject: [PATCH 04/11] =?UTF-8?q?add=2022=20=E6=9D=A8=E5=87=8C=E7=BF=94/?= =?UTF-8?q?=E7=AC=AC=E4=BA=8C=E5=8D=81=E4=B8=80=E6=AC=A1=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?/=E7=AC=94=E8=AE=B0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 杨凌翔 <963304364@qq.com> --- .../2022-11-24-\344\272\213\344\273\266.md" | 126 ++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 "22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\272\214\345\215\201\344\270\200\346\254\241\344\275\234\344\270\232/\347\254\224\350\256\260/2022-11-24-\344\272\213\344\273\266.md" diff --git "a/22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\272\214\345\215\201\344\270\200\346\254\241\344\275\234\344\270\232/\347\254\224\350\256\260/2022-11-24-\344\272\213\344\273\266.md" "b/22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\272\214\345\215\201\344\270\200\346\254\241\344\275\234\344\270\232/\347\254\224\350\256\260/2022-11-24-\344\272\213\344\273\266.md" new file mode 100644 index 0000000..2777c92 --- /dev/null +++ "b/22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\272\214\345\215\201\344\270\200\346\254\241\344\275\234\344\270\232/\347\254\224\350\256\260/2022-11-24-\344\272\213\344\273\266.md" @@ -0,0 +1,126 @@ +## 事件 + +#### 事件绑定 + +##### 传统事件绑定: + +兼容性好,但是不能绑定多个同类型事件。 + +##### 现代事件绑定: + +绑定多个同类型事件时会依次执行,但是兼容性较差 + +#### 事件取消 + +##### 传统事件取消(DOM 0 中): + +```js +btn.onclick = null +``` + +##### 现代事件取消(DOM 2 中): + +```js +//DOM +btn.removeEventListener('click',fn); +//IE +btn.detachEvent('onclick',fn); +``` + + + +#### 事件流 + +##### **事件冒泡**: + +微软提出了名为**事件冒泡**的事件流。事件按照从最特定的事件目标到最不特定的事件目标(document对象)的顺序触发。可以想象把一颗石头投入水中,泡泡会一直从水底冒出水面。也就是说,事件会从最内层的元素开始发生,一直向上传播,直到document对象。 + +##### **事件捕获**: + +网景提出另一种事件流名为**事件捕获**。事件从最不精确的对象(document 对象)开始触发,然后到最精确(也可以在窗口级别捕获事件,不过必须由开发人员特别指定),与事件冒泡相反,事件会从最外层开始发生,直到最具体的元素。同样形象的比喻一下可以想象成警察逮捕屋子内的小偷,就要从外面一层层的进入到房子内。 + +##### 事件流的三个阶段: + +事件有三个阶段,首先发生的是捕获阶段,然后是目标阶段,最后才是冒泡阶段,对于捕获和冒泡,我们只能干预其中的一个,通常来说,我们可能会干预事件冒泡阶段,而不去干预事件捕获阶段。 + +![img](https://img-blog.csdn.net/20170924010136220?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvYWxpZ2h0bWFu/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center) + + + +#### 事件阻止冒泡: + +```js +ev.stopPropagation(); //不支持ie9以下 DOM +event.cancelBubble = true; //ie独有 ie + +封装取消冒泡的函数:stopBubble(event) +``` + +#### 事件对象: + +ie: window.event + +非ie: e + +#### 阻止默认行为: + +默认事件:表单提交,a标签跳转,右键菜单等 + +```js +//以对象属性的方式注册的事件才生效 DOM0 +return false; +//阻止默认行为 DOM浏览器, ie9以下不支持 +ev.perventDefault(); +//阻止默认行为 DOM与IE +ev.returnValue = false +``` + +#### JS常用事件: + +##### 点击事件 + +onclick:单击事件 + +ondblclick:双击事件 + +##### 焦点事件 + +onblur:失去焦点 + +onfocus:元素获得焦点。 + +##### 加载事件 + +onload:一张页面或一幅图像完成加载。 + +##### 鼠标事件 + +onmousedown: 鼠标按钮被按下。 + +onmouseup: 鼠标按键被松开。 + +onmousemove: 鼠标被移动。 + +onmouseover: 鼠标移到某元素之上。 + +onmouseout :鼠标从某元素移开。 + +##### 键盘事件 + +onkeydown :某个键盘按键被按下。 + +onkeyup: 某个键盘按键被松开。 + +onkeypress :某个键盘按键被按下并松开。 + +##### 选择和改变 + +onchange :域的内容被改变。 + +onselect :文本被选中。 + +##### 表单事件 + +onsubmit :确认按钮被点击。 + +onreset: 重置按钮被点击 \ No newline at end of file -- Gitee From 9ae1e590ce4201e1ee48640b46bb9a8d5eb0bb59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=87=8C=E7=BF=94?= <963304364@qq.com> Date: Thu, 24 Nov 2022 08:46:58 +0000 Subject: [PATCH 05/11] =?UTF-8?q?update=2022=20=E6=9D=A8=E5=87=8C=E7=BF=94?= =?UTF-8?q?/=E7=AC=AC=E4=BA=8C=E5=8D=81=E4=B8=80=E6=AC=A1=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A/=E7=AC=94=E8=AE=B0/2022-11-24-=E4=BA=8B=E4=BB=B6.md.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 杨凌翔 <963304364@qq.com> --- .../2022-11-24-\344\272\213\344\273\266.md" | 3 --- 1 file changed, 3 deletions(-) diff --git "a/22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\272\214\345\215\201\344\270\200\346\254\241\344\275\234\344\270\232/\347\254\224\350\256\260/2022-11-24-\344\272\213\344\273\266.md" "b/22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\272\214\345\215\201\344\270\200\346\254\241\344\275\234\344\270\232/\347\254\224\350\256\260/2022-11-24-\344\272\213\344\273\266.md" index 2777c92..5dcf9cf 100644 --- "a/22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\272\214\345\215\201\344\270\200\346\254\241\344\275\234\344\270\232/\347\254\224\350\256\260/2022-11-24-\344\272\213\344\273\266.md" +++ "b/22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\272\214\345\215\201\344\270\200\346\254\241\344\275\234\344\270\232/\347\254\224\350\256\260/2022-11-24-\344\272\213\344\273\266.md" @@ -43,9 +43,6 @@ btn.detachEvent('onclick',fn); 事件有三个阶段,首先发生的是捕获阶段,然后是目标阶段,最后才是冒泡阶段,对于捕获和冒泡,我们只能干预其中的一个,通常来说,我们可能会干预事件冒泡阶段,而不去干预事件捕获阶段。 -![img](https://img-blog.csdn.net/20170924010136220?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvYWxpZ2h0bWFu/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center) - - #### 事件阻止冒泡: -- Gitee From 6aa5e69a5e01937a67b19deb18f4b339c5e38692 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=87=8C=E7=BF=94?= <963304364@qq.com> Date: Fri, 25 Nov 2022 05:37:21 +0000 Subject: [PATCH 06/11] =?UTF-8?q?add=2022=20=E6=9D=A8=E5=87=8C=E7=BF=94/?= =?UTF-8?q?=E7=AC=AC=E4=BA=8C=E5=8D=81=E4=B8=80=E6=AC=A1=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?/=E4=BD=9C=E4=B8=9A/test.html.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 杨凌翔 <963304364@qq.com> --- .../\344\275\234\344\270\232/test.html" | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 "22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\272\214\345\215\201\344\270\200\346\254\241\344\275\234\344\270\232/\344\275\234\344\270\232/test.html" diff --git "a/22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\272\214\345\215\201\344\270\200\346\254\241\344\275\234\344\270\232/\344\275\234\344\270\232/test.html" "b/22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\272\214\345\215\201\344\270\200\346\254\241\344\275\234\344\270\232/\344\275\234\344\270\232/test.html" new file mode 100644 index 0000000..9161e59 --- /dev/null +++ "b/22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\272\214\345\215\201\344\270\200\346\254\241\344\275\234\344\270\232/\344\275\234\344\270\232/test.html" @@ -0,0 +1,39 @@ + + + + + + + + Document + + + +
+ 地上 + 海里 + 天上 +
+

+ + + + \ No newline at end of file -- Gitee From 16479b6c34113e6da6d4dfea44e757a3fd481903 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=87=8C=E7=BF=94?= <963304364@qq.com> Date: Mon, 28 Nov 2022 03:54:47 +0000 Subject: [PATCH 07/11] =?UTF-8?q?=E6=96=B0=E5=BB=BA=20=E7=AC=AC=E4=BA=8C?= =?UTF-8?q?=E5=8D=81=E4=BA=8C=E6=AC=A1=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../.keep" | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 "22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\272\214\345\215\201\344\272\214\346\254\241\344\275\234\344\270\232/.keep" diff --git "a/22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\272\214\345\215\201\344\272\214\346\254\241\344\275\234\344\270\232/.keep" "b/22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\272\214\345\215\201\344\272\214\346\254\241\344\275\234\344\270\232/.keep" new file mode 100644 index 0000000..e69de29 -- Gitee From 51972e636c6f6e3346beda31da6a2b48dcd2bb38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=87=8C=E7=BF=94?= <963304364@qq.com> Date: Mon, 28 Nov 2022 03:55:04 +0000 Subject: [PATCH 08/11] =?UTF-8?q?=E6=96=B0=E5=BB=BA=20=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\344\275\234\344\270\232/.keep" | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 "22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\272\214\345\215\201\344\272\214\346\254\241\344\275\234\344\270\232/\344\275\234\344\270\232/.keep" diff --git "a/22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\272\214\345\215\201\344\272\214\346\254\241\344\275\234\344\270\232/\344\275\234\344\270\232/.keep" "b/22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\272\214\345\215\201\344\272\214\346\254\241\344\275\234\344\270\232/\344\275\234\344\270\232/.keep" new file mode 100644 index 0000000..e69de29 -- Gitee From 45dd9e6f0ed415c0a31f0ed06aee9e1d50b11ed6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=87=8C=E7=BF=94?= <963304364@qq.com> Date: Mon, 28 Nov 2022 03:55:14 +0000 Subject: [PATCH 09/11] =?UTF-8?q?=E6=96=B0=E5=BB=BA=20=E7=AC=94=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\347\254\224\350\256\260/.keep" | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 "22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\272\214\345\215\201\344\272\214\346\254\241\344\275\234\344\270\232/\347\254\224\350\256\260/.keep" diff --git "a/22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\272\214\345\215\201\344\272\214\346\254\241\344\275\234\344\270\232/\347\254\224\350\256\260/.keep" "b/22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\272\214\345\215\201\344\272\214\346\254\241\344\275\234\344\270\232/\347\254\224\350\256\260/.keep" new file mode 100644 index 0000000..e69de29 -- Gitee From 266f1cf8f12c7479156fdcf6e6a425b2deaa00bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=87=8C=E7=BF=94?= <963304364@qq.com> Date: Mon, 28 Nov 2022 03:55:45 +0000 Subject: [PATCH 10/11] =?UTF-8?q?add=2022=20=E6=9D=A8=E5=87=8C=E7=BF=94/?= =?UTF-8?q?=E7=AC=AC=E4=BA=8C=E5=8D=81=E4=BA=8C=E6=AC=A1=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?/=E7=AC=94=E8=AE=B0/2022-11-25-.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 杨凌翔 <963304364@qq.com> --- .../\347\254\224\350\256\260/2022-11-25-JQuery.md" | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 "22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\272\214\345\215\201\344\272\214\346\254\241\344\275\234\344\270\232/\347\254\224\350\256\260/2022-11-25-JQuery.md" diff --git "a/22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\272\214\345\215\201\344\272\214\346\254\241\344\275\234\344\270\232/\347\254\224\350\256\260/2022-11-25-JQuery.md" "b/22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\272\214\345\215\201\344\272\214\346\254\241\344\275\234\344\270\232/\347\254\224\350\256\260/2022-11-25-JQuery.md" new file mode 100644 index 0000000..3630414 --- /dev/null +++ "b/22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\272\214\345\215\201\344\272\214\346\254\241\344\275\234\344\270\232/\347\254\224\350\256\260/2022-11-25-JQuery.md" @@ -0,0 +1,14 @@ +## JQuery + +#### JQuery的优点: + +- 代码简洁 +- 完美兼容 +- 丰富的插件 + +#### JQuery选择器: + +- 基础选择器(标签选择器):$('div') +- id:# div +- class:. div +- 伪类选择器:$(':input') \ No newline at end of file -- Gitee From 594c90b1655b03f779bf30afa4a584280c89327a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=87=8C=E7=BF=94?= <963304364@qq.com> Date: Mon, 28 Nov 2022 04:00:26 +0000 Subject: [PATCH 11/11] =?UTF-8?q?add=2022=20=E6=9D=A8=E5=87=8C=E7=BF=94/?= =?UTF-8?q?=E7=AC=AC=E4=BA=8C=E5=8D=81=E4=BA=8C=E6=AC=A1=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?/=E4=BD=9C=E4=B8=9A/test.html.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 杨凌翔 <963304364@qq.com> --- .../\344\275\234\344\270\232/test.html" | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 "22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\272\214\345\215\201\344\272\214\346\254\241\344\275\234\344\270\232/\344\275\234\344\270\232/test.html" diff --git "a/22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\272\214\345\215\201\344\272\214\346\254\241\344\275\234\344\270\232/\344\275\234\344\270\232/test.html" "b/22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\272\214\345\215\201\344\272\214\346\254\241\344\275\234\344\270\232/\344\275\234\344\270\232/test.html" new file mode 100644 index 0000000..49c25f6 --- /dev/null +++ "b/22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\272\214\345\215\201\344\272\214\346\254\241\344\275\234\344\270\232/\344\275\234\344\270\232/test.html" @@ -0,0 +1,52 @@ + + + + + + + test + + + + + + + + + + + + + + + + + + + + + +
第一行
第二行
第三行
第四行
第五行
+ + 1 + 2 + 3 + 4 + + + + \ No newline at end of file -- Gitee