-
Notifications
You must be signed in to change notification settings - Fork 0
/
madLibs.html
70 lines (55 loc) · 1.59 KB
/
madLibs.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
<!DOCTYPE html>
<html lang="en">
<head>
<title>madLibs</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/dark.css">
<style>
h1 {
font-size: 75px;
color: red;
}
#questions {
font-size: 20px;
color: gold;
}
#results {
font-size: 30px;
font-weight: bold;
color: red;
}
</style>
</head>
<body>
<div align='center'>
<h1>madLibs</h1>
</div><br>
<div id="questions" align='center'>
<label>Enter a color: <input type="text" id="color"></label><br><br>
<label>Enter a noun: <input type="text" id="noun"></label><br><br>
<label>Enter a celebrity: <input type="text" id="celebrity"></label>
</div><br>
<div align='center'>
<button type='button' value="Submit" onclick="madLib()">
Submit
</button>
<button type="button" id="Demos">
<a href="demos.php">Back</a>
</button>
</div><br>
<div id='results' align='center'>
<script>
function madLib() {
document.getElementById("results").innerHTML = "";
const color = document.getElementsByTagName('input')[0].value;
const noun = document.getElementsByTagName('input')[1].value;
const celebrity = document.getElementsByTagName('input')[2].value;
document.getElementById("results").innerHTML +=
"Poem:<br> Roses are " + color + "<br>"
+ noun + "s are blue <br>"
+ "I love " + celebrity + "!";
}
</script>
</div>
</body>