当前位置:网站首页>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: 浏览器对象模型
用于操作浏览器上的各种属性

二、打开新页面

三、地址栏操作


四、浏览器信息读取

五、历史操作

边栏推荐
- 6_梯度下降法(Gradient Descent)
- [qt] container class, iterator, foreach keyword
- C language is more than a variety of descriptions of size. Don't stick to one way of writing
- "Syntaxerror: future feature annotations is not defined"
- MySQL associative table queries (reducing the number of queries)
- UNET notes
- [Qt]属性
- 10_评价分类结果(Evaluate classification)
- Blue Bridge Cup 1004 [recursive] cow story
- 【3. 基础搜索与图论初识】
猜你喜欢

Course notes of Professor Dalin of robotics platform

MySql

C语言 关机小程序

Find method of web page parsing by crawler

7_主成分分析法(Principal Component Analysis)

解析网页的完整回顾

Request attribute in crawler

放图仓库-Tsai

Matlab simulation of inverted pendulum control system based on qlearning reinforcement learning

【AcWing第61场周赛】
随机推荐
Nacos installation and pit stepping
[4.4 detailed explanation of fast power and inverse element of fast power]
【4.7 高斯消元详解】
2020-12-22 maximum common factor
When the label begins with "IMS", why does logcat not print the log?
MySQL associative table queries (reducing the number of queries)
[Qt]元对象系统
Drawing warehouse Tsai
c语言 比大小的多种描述,不要只拘泥于一种写法
Convolutional neural network -- lenet (pytorch Implementation)
Reduced dimension mean dot product matrix multiplicative norm probability normal distribution square loss
9_逻辑回归(Logistic Regression)
7_ Principal component analysis
2020-12-20 九九乘法表
Collection of 3D LUT related articles
Input a string of letters and output the vowels inside. I hope you guys can give guidance
Downloading and processing of sentinel-2
JS, one of the methods of object merging Assign (), recursive assignment & method of array merging..., array. Concat (), array. Push. Apply (), array. Push ()
程序员必做50题
[qt] attribute