forked from LaunchCodeEducation/javascript-projects
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscratchpad.html
More file actions
54 lines (53 loc) · 1.58 KB
/
scratchpad.html
File metadata and controls
54 lines (53 loc) · 1.58 KB
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
<!DOCTYPE html>
<html>
<head>
<title>Mouseover Event</title>
<script>
window.addEventListener("load", function() {
let list = document.getElementById("lane-list");
list.addEventListener("mouseover", function (event) {
let element = event.target;
element.innerHTML += ">";
console.log("target", element);
});
});
</script>
</head>
<body>
Mouseover Race
<ul id="lane-list">
<li>Lane 1</li>
<li>Lane 2</li>
<li>Lane 3</li>
</ul>
</body>
</html>
<!-- <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<button id="ring-button">Ring Bell</button>
<button id="greet-button">Greet Friends</button>
<p id="main-text"></p>
<script>
function youRang() {
document.getElementById("main-text").innerHTML += "you rang...";
console.log("you rang...");
}
function greetFriends() {
document.getElementById("main-text").innerHTML += "Hello Friends!";
console.log("Hello Friends!");
}
// Obtain a reference to the button element
let ringButton = document.getElementById("ring-button");
let greetButton = document.getElementById("greet-button");
// Set named function youRang as the click event handler
ringButton.addEventListener("click", youRang);
greetButton.addEventListener("click", greetFriends);
</script>
</body>
</html> -->