当前位置:网站首页>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
}
边栏推荐
- 6.29 problem solving
- How to realize the spelling correction function in search engine
- FPGA Development (1) -- serial port communication
- Digital collection of cultural relics, opening a new way of cultural inheritance
- 克隆无向图[bfs访问每条边而不止节点]
- Machine learning: the concept and application of VC dimension
- Introduction to reptiles: data capture of Betta barrage, with 11 introductory notes attached
- 云原生爱好者周刊:炫酷的 Grafana 监控面板集合
- This simple little function saves 213 hours for our production research team in half a year
- Set up enterprise NTP time server
猜你喜欢

How to write controller layer code gracefully?

QPainter的使用入门:绘制象棋界面

云原生爱好者周刊:炫酷的 Grafana 监控面板集合

About mongodb error: connecting to: mongodb://127.0.0.1:27017/?compressors=disabled &gssapiServiceName=mongodb

QT learning 01 GUI program principle analysis

Et la tarte aux framboises 4? Quels sont les jeux possibles?

Embedded development: Hardware in the loop testing

Activity invitation | the Apache Doris community essay and speech solicitation activity has begun!

The role of VMware virtual machine

koa2学习和使用
随机推荐
Set up enterprise NTP time server
How to write controller layer code gracefully?
Analysis of common vlog parameters
QT learning 06 widgets and window types
[advanced C language] address book implementation
Solr basic operation 16
Sword finger offer 15 Number of 1 in binary
Mysql:sql overview and database system introduction | dark horse programmer
Three postures of anti CSRF blasting
JVM之栈空间
Solr basic operations 9
js中的事件
由GlideException: Failed DecodePath{DirectByteBuffer->GifDrawable->Drawable}引起的刨根问底
Activity invitation | the Apache Doris community essay and speech solicitation activity has begun!
Stack space of JVM
Solr basic operations 12
云原生爱好者周刊:炫酷的 Grafana 监控面板集合
Rotating colored clover
漫画安全HIDS、EDR、NDR、XDR
Machine learning: the concept and application of VC dimension

