forked from RaphaelKing/array_and_hash
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtodo-list-bonus.html
More file actions
51 lines (47 loc) · 1.16 KB
/
todo-list-bonus.html
File metadata and controls
51 lines (47 loc) · 1.16 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
<html>
<style type="text/css">
.roman_numeral {
list-style-type: upper-roman;
}
</style>
<script src="https://code.jquery.com/jquery-1.12.1.min.js"></script>
<script type="text/javascript">
var topic_arr = [];
var description_dict = {};
function addTask(topic, description) {
topic_arr.push(topic);
description_dict[topic] = description
}
addTask("Math", ["Chapters 1 and 2", "Study for last year's regents"])
addTask("Physics", ["Newton's Laws", "Magnetics"])
addTask("English", ["Read \"The Giver\" by Lois Lowry", "Read \"A Rose for Emily\" by William Faulkner"])
addTask("History", ["World War I"])
$(document).ready(function() {
var ul_body = $("<ol>");
ul_body.appendTo('body');
for(var i = 0; i < topic_arr.length; i++) {
var topic = topic_arr[i]
var li = $("<li>",
{
text: topic
});
li.appendTo(ul_body);
var d = description_dict[topic];
var ul = $("<ol>",
{
class: "roman_numeral"
});
ul.appendTo(li);
for(var j = 0; j < d.length; j++) {
li = $("<li>",
{
text: d[j]
});
li.appendTo(ul);
}
}
});
</script>
<body>
</body>
</html>