Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1fb5a3f

Browse files
keyboard events
1 parent 71f5840 commit 1fb5a3f

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

‎Basic Introduction/index.html

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,29 @@
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">
66
<meta name="viewport" content="width=device-width, initial-scale=1.0">
77
<title>Document</title>
8+
9+
<style>
10+
11+
#box{
12+
height: 100px;
13+
width: 100px;
14+
background-color: blueviolet;
15+
cursor: pointer;
16+
}
17+
18+
</style>
819
</head>
920
<body>
1021

11-
<button id="btn">click me</button>
22+
<div id="box" ondblclick="myFunc()"></div>
1223

1324
<script>
1425

15-
let element = document.getElementById('btn');
16-
17-
function click1(){
18-
console.log('click 1 is activated');
19-
}
26+
window.addEventListener('keydown' , cheakKey)
2027

21-
function click2(){
22-
console.log('click2 is activated');
28+
function cheakKey(event){
29+
console.log(event.key)
2330
}
24-
25-
element.addEventListener('click' , click1);
26-
element.addEventListener('click' , click2);
27-
28-
element.removeEventListener('click' , click2);
29-
3031
</script>
31-
32-
3332
</body>
3433
</html>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /