Repository navigation
Expand file tree
/
Copy pathapp5-7.js
More file actions
155 lines (118 loc) · 3.61 KB
/
Copy pathapp5-7.js
File metadata and controls
155 lines (118 loc) · 3.61 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
'use strict'
const books =[
"the_crimson_iver",
"hobbit",
"1984",
"the_return_of_the_king",
"the_ruins_of_gorlan ",
"a_clash_of_kings",
"the_forty_rules_of_love",
"my_name_is_red",
"the_new_york_triology",
"the_tale_of_two_cities"
];
const bookInfo ={
the_crimson_river : {
title : "The crimson River",
author: "Jean-Christophe Grangé",
language : "Frech"
},
hobbit:{
title : "Hobbit",
author : "J.J.Tolkein",
language : "English"
},
1984:{
title : "1984",
author : "George Orwel",
language : "English"
},
the_return_of_the_king:{
title : "The Return of the King",
author : "J.J.Tolkein",
language : "English"
},
the_ruins_of_gorlan:{
title : "The Ruins of Gorlan",
author : "John Flanagan",
language : "English"
},
a_clash_of_kings:{
title : "A Clash of Kings",
author : "J. R. Martin",
language : "English"
},
the_forty_rules_of_love:{
title : "The Forthy Rules of Love",
author : "Elif Safak",
language : "Turkish"
},
my_name_is_red:{
title : "my Name is Red",
author : "Orhan Pamuk",
language : "Turkish"
},
the_new_york_triology:{
title : "The New York Triology",
author :"Paul Auster",
language : "English"
},
the_tale_of_two_cities:{
title : "The Tale of Two Cities",
author : "Charles Dickens",
language : "English"
}
}
function bookDetails(){
const ul = document.createElement("ul");
for (let i in books){
let bookLabel = books[i];
let li = document.createElement("li")
li.innerHTML=bookLabel;
let bookHead = document.createElement("h2");
bookHead.innerHTML=bookLabel.title;
let bookAuthor = document.createElement("p");
bookAuthor.innerHTML = bookLabel.author
let bookLanguage = document.createElement("p")
bookLanguage.innerHTML=bookLabel.language;
li.appendChild(ul);
bookHead.appendChild(li);
bookAuthor.appendChild(li);
bookLanguage.appendChild(li);
}
document.getElementById("show").appendChild(ul);
}
window.addEventListener("load",bookDetails)
//const ul = document.createElement("ul")
/*function bookList(){
for (let i=0; i<bookInfo.title.length; ++i){
let li = document.createElement("li");
let bookTitel = document.createElement("h2");
let bookAuthor = document.createElement("h3");
let bookLanguage = document.createElement("h4");
li.innerHTML=bookInfo.title[i];
ul.appendChild(li)
}
document.getElementById("show").appendChild(ul);
}
//window.addEventListener('load',bookList)*/
/*function bookLabel(){
const ul = document.createElement('ul')
for ( var k in bookInfo){
let book = bookInfo[k];
let li = document.createElement("li");
let bookTitel = document.createElement("h2");
bookTitel.innerHTML=book.title;
let bookAuthor = document.createElement("p");
bookAuthor.innerHTML=book.author;
let bookLanguage = document.createElement("p")
bookLanguage.innerHTML=book.language;
li.appendChild(bookTitel);
li.appendChild(bookAuthor);
li.appendChild(bookLanguage);
ul.appendChild(li);
}
return ul;
document.getElementById("show").appendChild(ul);
}
window.addEventListener('load',bookLabel)*/