-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathassignment.html
More file actions
39 lines (31 loc) · 951 Bytes
/
assignment.html
File metadata and controls
39 lines (31 loc) · 951 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
38
39
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>MadLib.html</title>
</head>
<body>
<h1>Mad Libs</h1>
<form>
<ul>
<li>Noun: <input type="text" id="noun">
<li>Adjective: <input type="text" id="adjective">
<li>Someone's Name: <input type="text" id="person">
</ul>
</form>
<button id="lib-button">Lib it!</button>
<div id="story"></div>
<script type="text/javascript">
function makeMadLib() {
var noun = document.getElementById("noun").value;
var adjective = document.getElementById("adjective").value;
var person = document.getElementById("person").value;
var outputStory = document.getElementById("story");
outputStory.innerHTML = noun + ' ' + adjective + ' ' + person + ' ';
}
var madLibConcat = document.getElementById("lib-button").innerText;
madLibConcat = document.getElementById("lib-button").addEventListener("click", makeMadLib) ;
makeMadLib();
</script>
</body>
</html>