-
Notifications
You must be signed in to change notification settings - Fork 0
/
RANDOM_NAME_GAME.html
60 lines (51 loc) · 1.46 KB
/
RANDOM_NAME_GAME.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Random Word Game which is created by KAVYA TRIVEDI</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="container">
<h1>Random Word Game</h1>
<label for="name">Enter your name:</label>
<input type="text" id="name" required>
<button onclick="generateWord()">Get Random Word</button>
<h2 id="output"></h2>
</div>
<script src="script.js"></script>
<style>
body {
font-family: Arial, sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
//created by kavyatrivedi
.container {
text-align: center;
}
//created by kavyatrivedi
input, button {
margin: 10px;
}
</style>
<script>
function generateWord() {
const name = document.getElementById("name").value;
/*CREATED BY KAVYA TRIVEDI*/
const words = ["legend", "virus", "vargin", "guy", "soon you will get your parthner", "sexy", "cute"];
/*CREATED BY KAVYA TRIVEDI*/
const randomIndex = Math.floor(Math.random() * words.length);
/*CREATED BY KAVYA TRIVEDI*/
const randomWord = words[randomIndex];
/*CREATED BY KAVYA TRIVEDI*/
const outputElement = document.getElementById("output");
outputElement.textContent = `${name}, your random word is: ${randomWord}`;
}
</script>
</body>
</html>