-
Notifications
You must be signed in to change notification settings - Fork 581
/
healt.html
139 lines (122 loc) · 4.01 KB
/
healt.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Health and Safety Alerts</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 20px;
}
/* Modal Container */
.modal {
display: none;
position: fixed;
z-index: 1000;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(0, 0, 0, 0.7); /* Black background with opacity */
justify-content: center;
align-items: center;
}
/* Modal Content */
.modal-content {
background-color: #fff;
margin: 15% auto;
padding: 20px;
border: 1px solid #888;
width: 90%;
max-width: 500px;
border-radius: 10px;
text-align: center;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}
/* Close Button */
.close {
color: #aaa;
float: right;
font-size: 28px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: black;
text-decoration: none;
cursor: pointer;
}
.modal-header {
font-size: 24px;
margin-bottom: 20px;
}
.modal-body {
font-size: 18px;
margin-bottom: 20px;
}
.modal-body img {
max-width: 100%;
height: auto;
margin-bottom: 20px;
border-radius: 10px;
}
.btn {
padding: 10px 20px;
font-size: 16px;
color: white;
background-color: #f44336;
border: none;
border-radius: 5px;
cursor: pointer;
}
.btn:hover {
background-color: #d32f2f;
}
</style>
</head>
<body>
<h1>Health and Safety Alerts</h1>
<p>Click the button below to see different health and safety alerts.</p>
<button class="btn" onclick="showModal('Health Alert', 'High temperature detected! Take immediate action to cool down.', 'saf.png')">Show Health Alert</button>
<button class="btn" onclick="showModal('Safety Alert', 'Unsafe chemical detected! Evacuate the area immediately.', 'chem.jpg')">Show Safety Alert</button>
<!-- The Modal -->
<div id="alertModal" class="modal">
<div class="modal-content">
<span class="close" onclick="closeModal()">×</span>
<div class="modal-header" id="modalHeader">Alert Title</div>
<div class="modal-body">
<img id="modalImage" src="" alt="Alert Image">
<p id="modalMessage">This is the alert message.</p>
</div>
<button class="btn" onclick="closeModal()">Close Alert</button>
</div>
</div>
<script>
function showModal(title, message, imageUrl) {
const modal = document.getElementById('alertModal');
const modalHeader = document.getElementById('modalHeader');
const modalMessage = document.getElementById('modalMessage');
const modalImage = document.getElementById('modalImage');
modalHeader.textContent = title;
modalMessage.textContent = message;
modalImage.src = imageUrl;
modal.style.display = 'flex';
}
function closeModal() {
const modal = document.getElementById('alertModal');
modal.style.display = 'none';
}
// Close the modal if the user clicks outside the modal content
window.onclick = function(event) {
const modal = document.getElementById('alertModal');
if (event.target === modal) {
closeModal();
}
}
</script>
</body>
</html>