-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwordgenerator.html
52 lines (50 loc) · 1.34 KB
/
wordgenerator.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Random Word Generator</title>
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
margin-top: 50px;
}
#word {
font-size: 24px;
font-weight: bold;
margin: 20px 0;
}
button {
padding: 10px 20px;
font-size: 16px;
cursor: pointer;
border: none;
border-radius: 5px;
background-color: #007bff;
color: white;
}
button:hover {
background-color: #0056b3;
}
</style>
</head>
<body>
<div id="word"></div>
<button onclick="generateWord()">Generate Word</button>
<script>
const words = [
"apple", "banana", "cherry", "dragonfruit", "elephant", "frog",
"guitar", "happiness", "island", "jupiter", "kangaroo", "lemon",
"mountain", "notebook", "ocean", "pencil", "queen", "rainbow",
"sunshine", "tiger", "umbrella", "volcano", "watermelon", "xylophone",
"yacht", "zebra"
];
function generateWord() {
const randomIndex = Math.floor(Math.random() * words.length);
const randomWord = words[randomIndex];
document.getElementById("word").innerText = randomWord;
}
</script>
</body>
</html>