当前位置:网站首页>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
}
边栏推荐
- Cacti maximum monitoring number test
- 漫画安全HIDS、EDR、NDR、XDR
- modelsim的TCL脚本的define incdir命令解析
- About mongodb error: connecting to: mongodb://127.0.0.1:27017/?compressors=disabled &gssapiServiceName=mongodb
- QT learning 05 introduction to QT creator project
- Solr basic operations 7
- Machine learning: the concept and application of VC dimension
- Buffer flow exercise
- Code analysis platform sonarqube actual combat
- How to realize the spelling correction function in search engine
猜你喜欢

After crossing, she said that the multiverse really exists

The role of VMware virtual machine

Basic tutorial for installing monggodb in win10

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

Vulnhub靶机-MoriartyCorp

由GlideException: Failed DecodePath{DirectByteBuffer->GifDrawable->Drawable}引起的刨根问底

Buffer flow exercise

Leetcode (680) -- verifying palindrome string II

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

Sword finger offer 14- I. cut rope
随机推荐
New CorelDRAW technical suite2022 latest detailed function introduction
Solr基础操作11
Siemens low code platform connects MySQL through database connector to realize addition, deletion, modification and query
FPGA Development (1) -- serial port communication
AI首席架构师9-胡晓光 《飞桨模型库与行业应用》
Solr basic operations 15
ThinkPad VMware installation virtual machine: this host supports Intel VT-x, but Intel VT-x is disabled (problem resolution)
QT learning 01 GUI program principle analysis
Solr basic operations 13
About mongodb error: connecting to: mongodb://127.0.0.1:27017/?compressors=disabled &gssapiServiceName=mongodb
Binary search tree 230 The element with the smallest K in the binary search tree 1038 From binary search tree to larger sum tree
Solr basic operations 14
Cacti maximum monitoring number test
golang7_ TCP programming
Project 1: deploy lamp ECSHOP e-commerce platform
The role of VMware virtual machine
JVM之栈空间
Solr基础操作13
QPainter的使用入门:绘制象棋界面
Sword finger offer 13 Range of motion of robot

