当前位置:网站首页>DOM day_04(7.12)BOM、打开新页面(延迟打开)、地址栏操作、浏览器信息读取、历史操作
DOM day_04(7.12)BOM、打开新页面(延迟打开)、地址栏操作、浏览器信息读取、历史操作
2022-07-26 22:38:00 【加1床铺盖】
复习
1.冒泡机制
(1)当子元素上发生事件时, 可以传递其父元素
(2)事件委托:
- 通过父元素帮助子元素完成事件
- 适合场景: 动态新增的子元素
(3)事件参数
- target: 此属性存储触发事件的
当事元素 - stopPropagation: 阻止冒泡事件
2.阻止默认事件: 事件参数中的 preventDefault. 主要用于超链接
3.鼠标点击的事件参数, 几组坐标值
- screenX, screenY: 相对屏幕左上角
- x, y: 相对浏览器内容区域的左上角
- offsetX, offsetY : 相较于点击事件发生的当事元素左上角
4.页面滚动事件: onscroll
- 读取偏移量:
document.documentElement.scrollTop || document.body.scrollTop
5.属性的旧版本操作
- getAttribute: 获取某属性的值
- setAttribute: 设置某属性的值
6.JS方式创建DOM元素
(1)追求极致性能: 放弃用HTML代码来书写, 直接用JS代码
document.createElement(标签名)
(2)文档片段: 提高 遍历创建DOM元素时的性能消耗
把遍历生成的DOM的元素先放在片段里, 最后把片段放到页面上
7.DOM的封装(选修)
- 利用函数的封装技巧, 把原生DOM进行了简化.
document.querySelectorAll->$- 提供了更多的原型方法, 自动实现遍历
- 这套思想就是
jQuery的封装思想
这套思想就是
jQuery的封装思想
DOM的套路就两点:
先找到要操作的元素
多个元素, 则需要遍历
操作元素的属性
一、BOM
Browser Object Model: 浏览器对象模型
用于操作浏览器上的各种属性

二、打开新页面

三、地址栏操作


四、浏览器信息读取

五、历史操作

边栏推荐
- Knowledge distillation -- pytorch implementation
- 用New,delete和用malloc,free申请,释放堆区空间
- Matlab simulation of inverted pendulum control system based on qlearning reinforcement learning
- Lt9611ux Mipi to HDMI 2.0 dual port with audio
- Collection of 3D LUT related articles
- JS, one of the methods of object merging Assign (), recursive assignment & method of array merging..., array. Concat (), array. Push. Apply (), array. Push ()
- [Qt]容器类、迭代器、foreach关键字
- 9_逻辑回归(Logistic Regression)
- 2020-12-20 99 multiplication table
- In JS, the common writing methods and calling methods of functions - conventional writing, anonymous function writing, taking the method as an object, and adding methods to the object in the construct
猜你喜欢

Sliding window problem summary

Mysql互不关联的联表查询(减少了查询的次数)

Three tier architecture simulation

View where Anaconda created the environment

【4.10 博弈论详解】
![[qt] container class, iterator, foreach keyword](/img/88/d9d5be096009b4e5baa0966e6f292c.jpg)
[qt] container class, iterator, foreach keyword

AutoCAD的卸载后重新安装,删除注册表的详细过程

7_ Principal component analysis

13_ Ensemble learning and random forests

Configure deeplobcut 1 with your head covered
随机推荐
[4.6 detailed explanation of Chinese remainder theorem]
[4.2 approximations]
V-viewer use
【AtCoder Beginner Contest 261 (A·B·C·D)】
torch.相关函数
Openharmony quick start
Friend友元函数以及单例模式
放图仓库-3(功能图像)
Three tier architecture simulation
13_集成学习和随机森林(Ensemble Learning and Random Forests)
Sliding window problem summary
【4.10 博弈论详解】
[qt] container class, iterator, foreach keyword
6_梯度下降法(Gradient Descent)
[4.3 detailed explanation of Euler function]
Shufflenet series (2): explanation of shufflenet V2 theory
Leetcode high frequency question: the choice of the inn, how many options to choose accommodation, to ensure that you can find a coffee shop with a minimum consumption of no more than p yuan in the ev
Visual studio C cs0006 C failed to find metadata file
CDs simulation of minimum dominating set based on MATLAB
【Codeforces Round #807 (Div 2.) A·B·C】