当前位置:网站首页>[summary of two registration methods]
[summary of two registration methods]
2022-07-05 03:33:00 【renrenrenrenqq】
Summary of two registration methods
on Registration method at the beginning
Register multiple ways for the same event , The bottom will cover the top , Only one , Have uniqueness
Commonly used onclick Click on an object ,onmousemove Mouse moved ,onkeydown A key on a keyboard is pressed
<!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>Document</title>
</head>
<body>
<button id="annniu">button</button>
</body>
<script>
var button=document.querySelector('#annniu')
button.onclick=function(){
console.dir('1')
}
button.onclick=function(){
console.dir('2')
}
</script>
</html>
Express only 2
2. Monitoring mode
Register multiple ways for the same event , They don't cover each other
utilize addEventListener(type( Event type , No addition on),listener( Event handler ),useCapture( Boolean value , It can be omitted , It is often used to judge bubble and capture ));
true capture ,false Bubbling
<!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>Document</title>
</head>
<body>
<button id="annniu">button</button>
</body>
<script>
var button=document.querySelector('#annniu')
button.addEventListener('click',function()
{
console.dir('1')
})
button.addEventListener('click',function()
{
console.dir('2')
})
</script>
</html>
expression 1 and 2
边栏推荐
- Solve the problem that sqlyog does not have a schema Designer
- The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety
- DECLARE_ WAIT_ QUEUE_ HEAD、wake_ up_ Interruptible macro analysis
- 问下,这个ADB mysql支持sqlserver吗?
- 有個疑問 flink sql cdc 的話可以設置並行度麼, 並行度大於1會有順序問題吧?
- [luat-air105] 4.1 file system FS
- Kubernetes - Multi cluster management
- Hot knowledge of multithreading (I): introduction to ThreadLocal and underlying principles
- Easy processing of ten-year futures and stock market data -- Application of tdengine in Tongxinyuan fund
- Anchor free series network yolox source code line by line explanation Part 2 (a total of 10, ensure to explain line by line, after reading, you can change the network at will, not just as a participan
猜你喜欢
2. Common request methods
Tiny series rendering tutorial
Apache build web host
Devtools的简单使用
The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety
Single box check box
Azkaban overview
Machine learning experiment report 1 - linear model, decision tree, neural network part
Asemi rectifier bridge 2w10 parameters, 2w10 specifications, 2w10 characteristics
Talk about the SQL server version of DTM sub transaction barrier function
随机推荐
有個疑問 flink sql cdc 的話可以設置並行度麼, 並行度大於1會有順序問題吧?
How to learn to get the embedding matrix e # yyds dry goods inventory #
Azkaban安装部署
51 independent key basic experiment
Devtools的簡單使用
IPv6 experiment
Jd.com 2: how to prevent oversold in the deduction process of commodity inventory?
El select, El option drop-down selection box
ICSI213/IECE213 Data Structures
Talk about the SQL server version of DTM sub transaction barrier function
Azkaban实战
Redis6-01nosql database
Vb+access hotel service management system
Is there any way to change the height of the uinavigationbar in the storyboard without using the UINavigationController?
Smart pointer shared_ PTR and weak_ Difference of PTR
SQL performance optimization skills
el-select,el-option下拉选择框
Six stone programming: advantages of automated testing
Three line by line explanations of the source code of anchor free series network yolox (a total of ten articles, which are guaranteed to be explained line by line. After reading it, you can change the
Performance of calling delegates vs methods