forked from magrawal-USF/Javascript-JQuery-Charting
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathL5-HTMLPage8.html
61 lines (44 loc) · 1.41 KB
/
L5-HTMLPage8.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
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>JavaScript user input</title>
<script>
function getUserInput() {
var city1 = prompt("What is the first of 4 cities?", "Tampa");
var city2 = prompt("What is the second of 4 cities?", "Tampa");
var city3 = prompt("What is the third of 4 cities?", "Tampa");
var city4 = prompt("What is the fourth of 4 cities?", "Tampa");
var cities = [city1, city2, city3, city4];
var ulElement = document.createElement("ul");
for (var city in cities) {
var cityListItem = document.createElement("li");
var cityListItemtext = document.createTextNode(cities[city]);
cityListItem.appendChild(cityListItemtext);
var listItem = ulElement.appendChild(cityListItem);
if (cities[city] == "Tampa") {
alert("adding your home town!");
}
if (city == "0") {
alert("Equal!");
}
if (city == 0) {
alert("Equal too!");
}
if (city === 0) {
alert("Equal?");
}
else {
alert("Type mismatch");
}
}
var bodyNode = document.getElementsByTagName("body")[0];
bodyNode.appendChild(ulElement);
}
</script>
</head>
<body>
<h1>JavaScript user input</h1>
<button onclick="getUserInput()">Click me</button>
</body>
</html>