-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmouseEvents.html
More file actions
33 lines (28 loc) · 992 Bytes
/
mouseEvents.html
File metadata and controls
33 lines (28 loc) · 992 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Mouse Events</title>
</head>
<body>
<p id="p_one">Hello. Welcome to my web page</p>
<button id="btn_one" name="btn_one" class="btn_change" >Change Text</button>
<script>
var btn = document.getElementById("btn_one");
function changeText(event){
console.log(event);
var txt = document.getElementById("p_one");
txt.innerText = "This is a lesson in HTML DOM, Events and Events Listeners."
}
document.addEventListener("mousedown", event => {
console.log(event);
console.log("You have pressed the mouse button" );
});
document.addEventListener("mouseup", event => {
console.log(event);
console.log("You have released the mouse button" );
});
</script>
</body>
</html>