-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
28 lines (27 loc) · 854 Bytes
/
Copy pathindex.html
File metadata and controls
28 lines (27 loc) · 854 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
<!DOCTYPE html>
<html lang="en">
<head>
<title>Fun</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div>
<h3>Do you like my website?</h3>
<p>try clicking No</p>
<p>Works better in desktop</p>
<button id="b1">Yes</button>
<button id="btn">No</button>
<script>
const button = document.getElementById('btn');
const b1 = document.getElementById('b1');
button.addEventListener('mouseover', function () {
button.style.left = `${Math.ceil(Math.random() * 90)}%`;
button.style.top = `${Math.ceil(Math.random() * 90)}%`;
});
b1.addEventListener('click', function () {
alert("I Knew It!");
})
</script>
</div>
</body>
</html>