forked from magrawal-USF/Javascript-JQuery-Charting
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathL5-HTMLPage10.html
43 lines (30 loc) · 931 Bytes
/
L5-HTMLPage10.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
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>do ... while</title>
<script>
function getUserInput() {
var city;
var cities = new Array();
do {
city = prompt("What is the city?", "Tampa");
cities.push(city);
} while (city != "Tampa")
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);
}
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>