forked from magrawal-USF/Javascript-JQuery-Charting
-
Notifications
You must be signed in to change notification settings - Fork 197
Expand file tree
/
Copy pathHTMLPage12.html
More file actions
55 lines (39 loc) · 1.25 KB
/
HTMLPage12.html
File metadata and controls
55 lines (39 loc) · 1.25 KB
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
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>switch</title>
<script>
function getUserInput() {
var cities = ["Tampa", "Orlando", "Miami", "Naples"];
for (var city in cities) {
switch (cities[city]) {
case "Tampa":
alert("Welcome home to " + cities[city]);
break;
case "Orlando":
alert("Welcome to Mickey's town, " + cities[city]);
break;
case "Miami":
alert("Welcome to the south in " + cities[city]);
break;
case "Naples":
alert("Welcome to the gulf coast in " + cities[city]);
break;
}
var ulElement = document.createElement("ul");
var cityListItem = document.createElement("li");
var cityListItemtext = document.createTextNode(cities[city]);
cityListItem.appendChild(cityListItemtext);
var listItem = ulElement.appendChild(cityListItem);
}
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>