-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAssignment_10.js
More file actions
39 lines (29 loc) · 1005 Bytes
/
Assignment_10.js
File metadata and controls
39 lines (29 loc) · 1005 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
34
35
36
37
38
39
let box = document.querySelector("#box");
box.addEventListener("mouseout", function (){
console.log(event);
console.log("Target:", event.target);
console.log("Related Target:", event.relatedTarget);
});
let inp = document.querySelector("input");
inp.addEventListener("keypress", function (){
console.log(event);
console.log("Key",event.key);
console.log("Code",event.code);
});
let box2 = document.querySelector("#box2");
box2.addEventListener("scroll", function (){
console.log("Text was Scrolling");
});
let img = document.querySelector("#myImg");
img.addEventListener("load", function (){
console.log("Image has finished loading!");
alert("Image is fully loaded and ready to display.");
});
let btn2 = document.createElement("button");
btn2.innerText = "Click Me";
let body = document.querySelector("body");
body.append(btn2);
btn2.addEventListener("click", function (){
console.log("Button Was Clicked");
btn2.style.backgroundColor = "green";
});