Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ea654b7

Browse files
author
zohir rayhan
committed
Add the first Exercice of JS2 W1
1 parent 5f9e431 commit ea654b7

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
<title>Document</title>
8+
</head>
9+
<body>
10+
11+
12+
<script src="bookList.js">
13+
14+
</script>
15+
16+
</body>
17+
</html>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
var mesLivres=[
2+
{
3+
title:"Les Crapauds-brousse",
4+
author:"Tierno Monénembo",
5+
alreadyRead:true,
6+
imgSrc:"https://media.senscritique.com/media/000006441212/source_big/Les_crapauds_brousse.jpg",
7+
},
8+
{
9+
title: "La Révolte des bovidés",
10+
author: "Amadou Hampâté Bâ",
11+
alreadyRead: false,
12+
imgSrc:"https://images-eu.ssl-images-amazon.com/images/I/61d84huBGyL.jpg",
13+
},
14+
{
15+
title: "Hosties noires",
16+
author: "Léopold Sédar Senghor",
17+
alreadyRead: true,
18+
imgSrc:"https://images-na.ssl-images-amazon.com/images/I/41ZQjlvZ2QL._AC_SY400_.jpg",
19+
}
20+
21+
]
22+
var para = document.createElement("p");
23+
var ulList = document.createElement("ul");
24+
for (let livreX of mesLivres ) {
25+
var div=document.createElement("div");
26+
var liList = document.createElement("li");
27+
var myImg = document.createElement("img");
28+
if(livreX.alreadyRead){
29+
div.style.background="red";
30+
}else{div.style.background="green";}
31+
myImg.src=livreX.imgSrc;
32+
myImg.style.height="100px";
33+
myImg.style.width="100px";
34+
var nodeli = document.createTextNode(livreX.title+' of '+livreX.author);
35+
liList.appendChild(nodeli);
36+
ulList.appendChild(div);
37+
div.appendChild(liList);
38+
div.appendChild(myImg);
39+
console.log(mesLivres.length) ;
40+
}
41+
var myBody = document.querySelector("body");
42+
myBody.appendChild(para);
43+
para.appendChild(ulList);
44+

0 commit comments

Comments
 (0)