-
Notifications
You must be signed in to change notification settings - Fork 0
/
mouseDown.html
75 lines (70 loc) · 1.79 KB
/
mouseDown.html
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.box{
width: 100px;
height: 100px;
background-color: aqua;
text-align: center;
line-height: 100px;
cursor: pointer;
}
#seed{
width: 100px;
height: 100px;
background-color: rgb(234, 44, 129);
position: absolute;
left: 50px;
right: 50px;
}
</style>
</head>
<body>
<div class="box" onmousedown="handleMouseDown()">
click or drag
</div>
<script>
function handleMouseDown(){
document.write("Mouse Button Pressed Down")
}
</script>
<div id="seed" onmousemove="handleMouseMove(event)"></div>
<script>
function handleMouseMove(event){
const element=document.getElementById('seed');
element.style.left=event.clientX+'px';
element.style.bottom=event.clientY+'px';
element.style.right=event.clientZ+'px';
element.style.top=event.clientW+'px';
}
</script>
<div class="box" onmouseup="handleMouseup()">
click or up
</div>
<script>
function handleMouseup(){
document.write("Mouse Button Pressed Down")
}
</script>
<div class="box" onmouseover="handleMouseover()">
click or over
</div>
<script>
function handleMouseover(){
document.write("Mouse Button Pressed Down")
}
</script>
<div class="box" onmouseout="handleMouseout()">
click or out
</div>
<script>
function handleMouseout(){
document.write("Mouse Button Pressed Down")
}
</script>
</body>
</html>