当前位置:网站首页>[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
边栏推荐
- IPv6 experiment
- Design and practice of kubernetes cluster and application monitoring scheme
- Pat class a 1162 postfix expression
- [groovy] string (string splicing | multi line string)
- Watch the online press conference of tdengine community heroes and listen to TD hero talk about the legend of developers
- Simple use of devtools
- Linux Installation redis
- Devtools的简单使用
- 单项框 复选框
- Cette ADB MySQL prend - elle en charge SQL Server?
猜你喜欢
Bumblebee: build, deliver, and run ebpf programs smoothly like silk
线程基础知识
The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety
Hot knowledge of multithreading (I): introduction to ThreadLocal and underlying principles
Pat class a 1160 forever (class B 1104 forever)
The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety
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
Pdf things
Flume configuration 4 - customize mysqlsource
Mongodb common commands
随机推荐
Azkaban installation and deployment
Bumblebee: build, deliver, and run ebpf programs smoothly like silk
Flume配置4——自定义MYSQLSource
Necessary fonts for designers
[groovy] string (string injection function | asBoolean | execute | minus)
About MySQL database connection exceptions
[luat-air105] 4.1 file system FS
Dart series: collection of best practices
040. (2.9) relieved
为什么腾讯阿里等互联网大厂诞生的好产品越来越少?
FBO and RBO disappeared in webgpu
Devtools的簡單使用
Master Fur
What is the most effective way to convert int to string- What is the most efficient way to convert an int to a String?
Mongodb common commands
Sqoop安装
Returns the lowest common ancestor of two nodes in a binary tree
Delphi read / write JSON format
Class inheritance in C #
腾讯云,实现图片上传