当前位置:网站首页>Events in JS
Events in JS
2022-06-30 00:10:00 【Shanlan ~】
- index.html
<!DOCTYPE html>
<html lang = "en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="/css/index.css">
<title> myFirstWeb</title>
</head>
<body>
<p>
hello world!
</p>
<script type="module"> import {
main } from "/js/index.js"; main(); </script>
<div></div>
</body>
</html>
href The path in can be modified ;
from The path in can also be modified ;
- index.css
div{
width: 300px;
height : 300px;
background-color: rgb(95, 148, 165);
}
- index.js
let div = document.querySelector('div');
function main()
{
}
export{
main
}
design sketch :
File structure chart :
the second , Determination of events
:
<!DOCTYPE html>
<html lang = "en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="/css/index.css">
<title> myFirstWeb</title>
</head>
<body>
<p>
hello world!
</p>
<script type="module"> import {
main } from "/js/index.js"; main(); </script>
<div tabindex="0"></div>
<input type="text">
</body>
</html>
div{
width: 300px;
height : 300px;
background-color: rgb(95, 148, 165);
}
let div = document.querySelector('div');
let input = document.querySelector('input');
function main()
{
div.addEventListener('mousedown', function(event)
{
console.log(event.type , event.button);
})
div.addEventListener('mouseup', function(event)
{
console.log(event.type , event.button);
})
input.addEventListener('keydown', function(event)
{
console.log(event.type, event.code , event.shiftKey, event.ctrlKey , event.altKey);
})
window.addEventListener('resize', function(e)
{
console.log(e.type)
}
}
export{
main
}
边栏推荐
- Solr basic operations 14
- 复制带随机指针的链表[空间换时间--hash记录]
- 【微信小程序】认识小程序项目的基本组成结构
- Color space conversion in video tonemapping (HDR to SDR) (bt2020 to bt709, YCbCr, YUV and RGB)
- Halcon practical: design idea of solder joint detection
- 6.29 problem solving
- MySQL multi table query
- Cacti maximum monitoring number test
- Vulnhub target -moriartycorp
- Introduction to reptiles: data capture of Betta barrage, with 11 introductory notes attached
猜你喜欢

Vulnhub target -moriartycorp

Vulnhub靶机-MoriartyCorp
![Cloner un Graphe non recté [bfs accède à chaque bord et pas seulement aux noeuds]](/img/34/2a1b737b6095293f868ec6aec0ceeb.png)
Cloner un Graphe non recté [bfs accède à chaque bord et pas seulement aux noeuds]

How to write controller layer code gracefully?

Golang6 reflection

MySQL:SQL概述及数据库系统介绍 | 黑马程序员

8软件工程环境
![Clone undirected graph [bfs accesses each edge but not only nodes]](/img/34/2a1b737b6095293f868ec6aec0ceeb.png)
Clone undirected graph [bfs accesses each edge but not only nodes]

This simple little function saves 213 hours for our production research team in half a year

How about counting Berry Pie 4? What are the possible ways to play?
随机推荐
Label Troubleshooting: unable to open the marked image
JVM之栈空间
手机开户后多久才能通过?另外,手机开户安全么?
Some specifications based on zfoo development project
Official website of Greentree
Fine grained identification, classification, retrieval data set collation
[advanced C language] string and memory function (I)
Andorid source build/envsetup. SH details to know
How to write controller layer code gracefully?
Solr基础操作15
The role of VMware virtual machine
Golang6 reflection
Embedded development: Hardware in the loop testing
QT learning 04 Hello QT
如何实现搜索引擎中的拼写纠错功能——思路
Solr basic operation 11
js中的事件
How to view the CPU cores and threads in win11? Win11 view the tutorial of how many cores and threads the CPU is
Basic operations such as MySQL startup under Windows platform
Web APIs environment object - dark horse programmer

