当前位置:网站首页>BOM DOM
BOM DOM
2022-07-02 12:36:00 【大海裏沒有水】
一、BOM



注意: window繼承EventTarget
二、DOM

1、事件監聽

2、事件流 - 事件冒泡 / 事件捕獲


3、事件對象的屬性和方法
const spanEL = document.querySelector(".span");
// 在回調這個函數的時候,會傳遞event參數
spanEL.addEventListener("click", function (event) {
console.log("span被點擊", event);
console.log("事件的類型", event.type);
// 當發生點擊和處理點擊的元素不一樣
console.log("事件的元素", event.target, event.currentTarget);
console.log("事件發生的比特置", event.offsetX, event.offsetY);
});
// 常用的方法
// preventDefault, 防止默認行為
const aEl = document.querySelector("a")
aEl.addEventListener("click", (event) => {
event.preventDefault();
})
// stopPropagation ,可阻止事件捕獲
边栏推荐
- drools执行指定的规则
- H5 to app
- Leetcode - Sword finger offer 37, 38
- 5g era, learning audio and video development, a super hot audio and video advanced development and learning classic
- Post request body content cannot be retrieved repeatedly
- Less than three months after the programmer was hired, the boss wanted to launch the app within one month. If he was dissatisfied, he was dismissed immediately
- kubenetes中port、targetPort、nodePort、containerPort的区别与联系
- 趣味 面试题
- Gaode map test case
- Programmers can't find jobs after the age of 35? After reading this article, you may be able to find the answer
猜你喜欢

MySQL indexes and transactions

中国交通标志检测数据集

Distributed machine learning framework and high-dimensional real-time recommendation system
![[FFH] little bear driver calling process (take calling LED light driver as an example)](/img/e7/153ae9f1befc12825d277620049f9d.jpg)
[FFH] little bear driver calling process (take calling LED light driver as an example)

Take you ten days to easily finish the finale of go micro services (distributed transactions)

Is the neural network (pinn) with embedded physical knowledge a pit?

【工控老马】西门子PLC Siemens PLC TCP协议详解

Jenkins用户权限管理

drools决策表的简单使用

Sparkcontext: error initializing sparkcontext solution
随机推荐
倍增 LCA(最近公共祖先)
Leetcode - Sword finger offer 37, 38
Leetcode14 longest public prefix
Codeforces 771-div2 C (trouble, permutation is not very good)
IPhone 6 plus is listed in Apple's "retro products" list
Input a three digit number and output its single digit, ten digit and hundred digit.
arcgis js 4. Add pictures to x map
Lekao.com: experience sharing of junior economists and previous candidates in customs clearance
CDA data analysis -- common knowledge points induction of Excel data processing
CV2 in OpenCV VideoWriter_ Fourcc() function and cv2 Combined use of videowriter() function
Intel internal instructions - AVX and avx2 learning notes
The second composition template of postgraduate entrance examination English / chart composition, English chart composition is enough
Leetcode122 the best time to buy and sell stocks II
Deep copy event bus
Deep understanding of P-R curve, ROC and AUC
Openssh remote enumeration username vulnerability (cve-2018-15473)
There is a hidden danger in CDH: the exchange memory used by the process of this role is XX megabytes. Warning threshold: 200 bytes
测试左移和右移
Jenkins user rights management
Day12 control flow if switch while do While guessing numbers game