-
Notifications
You must be signed in to change notification settings - Fork 0
/
expt_8.html
72 lines (66 loc) · 1.69 KB
/
expt_8.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Experiment 8 - Event Handling</title>
<style>
body {
text-align: center;
}
.flex-container {
display: flex;
margin: 0 auto;
justify-content: center;
}
#over,
#focus {
border: 1px solid black;
margin: 10px;
padding: 20px;
border-radius: 16px;
}
</style>
</head>
<body id="bd">
<h2>42360_Om Shinde</h2>
<hr />
<h2>
Write a JavaScript program to create a Home page of any website and change background color using <br />
i. On mouse over event <br />
ii. On focus event
</h2>
<hr />
<div class="flex-container">
<div id="over">
<h4>On Mouse Over Event</h4>
<button onmouseover="mouseover()" onmouseout="mouseout()">
Hover Over Me
</button>
</div>
<div id="focus">
<h4>On Focus Event</h4>
<input type="text" onfocus="focusele()" onblur="mouseout()" />
</div>
</div>
<br>
<div>
<p id="text"></p>
</div>
<script>
function mouseover() {
document.getElementById("bd").style.backgroundColor = "#A0E9FF";
document.getElementById("text").innerHTML = "Hover effect activated!";
}
function mouseout() {
document.getElementById("bd").style.backgroundColor = "#fff";
document.getElementById("text").innerHTML = "";
}
function focusele() {
document.getElementById("bd").style.backgroundColor = "#99B080";
document.getElementById("text").innerHTML = "Focus effect activated";
}
</script>
</body>
</html>