-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path5.html
More file actions
37 lines (32 loc) · 992 Bytes
/
Copy path5.html
File metadata and controls
37 lines (32 loc) · 992 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Random Greeting Generator</title>
</head>
<body>
<h1>Random Greeting Generator</h1>
<p id="wish"></p>
<button id="generateButton">Generate Greeting</button>
<script>
// Array of quotes
const wishes = [
"Hey",
"Hello",
"Hi",
"Hola",
"Heya"
];
const wishElement = document.getElementById("wish");
const generateButton = document.getElementById("generateButton");
function generateRandomWish() {
const randomIndex = Math.floor(Math.random() * wishes.length);
const randomWish = wishes[randomIndex];
wishElement.textContent = randomWish;
}
generateButton.addEventListener("click", generateRandomWish);
generateRandomWish();
</script>
</body>
</html>