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

Skip to content
This repository was archived by the owner on May 14, 2024. It is now read-only.

Commit af575b0

Browse files
committed
1st homework commit
1 parent 5f9e431 commit af575b0

File tree

10 files changed

+137
-0
lines changed

10 files changed

+137
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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>Evina's Book List</title>
8+
</head>
9+
<body>
10+
11+
<script src= "Ex1BookList.js"></script>
12+
</body>
13+
</html>

Week1/HW1/js-exercises/Ex1BookList.js

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
const books = [
2+
{
3+
title: 'The Power of Now',
4+
author: 'Eckhart Tolle',
5+
alreadyRead: true,
6+
image: './images/tolle.jpg'
7+
},
8+
{
9+
title: 'The Anatomy of the Spirit',
10+
author: 'Carolyn Myss',
11+
alreadyRead: false,
12+
image: './images/myss.jpg',
13+
},
14+
{
15+
title: 'White Fang',
16+
author: 'Jack London',
17+
alreadyRead: true,
18+
image: './images/london.jpg',
19+
},
20+
];
21+
22+
var ListOfBooks = books.map(BookIndex);
23+
24+
function BookIndex(books){
25+
var sentences = document.createElement("P");
26+
sentences.innerText= books.title + " written by " + books.author + ".";
27+
document.body.appendChild(sentences);
28+
}
29+
30+
var UlBooks = books.map(BookUl);
31+
32+
function BookUl(books){
33+
var list = document.createElement("LI");
34+
list.innerText = books.title + " by " +books.author;
35+
document.body.appendChild(list);
36+
};
37+
38+
39+
var coverImages = books.map(covers);
40+
41+
function covers(img) {
42+
var imageCover = document.createElement('img');
43+
44+
imageCover.src = books.image;
45+
imageCover.width = "100";
46+
imageCover.height = "100";
47+
imageCover.style = "margin: 10px " ;
48+
document.body.appendChild(imageCover); };
49+
50+
51+
var imageCovers = document.getElementsByTagName("img");
52+
console.log(imageCovers);
53+
var i ;
54+
for (i = 0; i < books.length; i++) {
55+
if (books.alreadyRead === true) {
56+
imageCovers.style = "border: 50px solid red";
57+
}
58+
else { imageCovers.style = "border: 50px solid green";
59+
}
60+
}
61+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>About Me</title>
6+
<style>
7+
.list-item {color: rgb(255, 0, 0); };
8+
</style>
9+
</head>
10+
<body>
11+
<h1>About Me</h1>
12+
13+
<ul>
14+
<li>Nickname: <span id="nickname"></span></li>
15+
<li>Favorite food: <span id="fav-food"></span></li>
16+
<li>Hometown: <span id="hometown"></span></li>
17+
</ul>
18+
<script src = "Ex2_about_me.js"></script>
19+
</body>
20+
</html>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
var x = document.body.style.fontFamily = 'Arial,sans-serif';
2+
3+
var Nickname = document.getElementById("nickname");
4+
Nickname.innerText= "Evina";
5+
6+
var FavFood = document.getElementById('fav-food');
7+
FavFood.innerText = "Pastitsio";
8+
9+
var Home = document.getElementById("hometown");
10+
Home.innerText = "Athens";
11+
12+
var liItems= document.querySelectorAll('li');
13+
console.log(liItems);
14+
for (var i = 0; i < liItems.length; i ++) {
15+
liItems[i].className= "list-item";
16+
}
17+
18+
var newImg = document.createElement('img');
19+
newImg.src= "./images/explosion.png";
20+
document.body.appendChild(newImg);
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
setInterval (tellTime, 1);
2+
3+
function tellTime (time){
4+
var date = new Date();
5+
var h = date.getHours();
6+
var m = date.getMinutes();
7+
var s = date.getSeconds();
8+
document.getElementById("watch").innerHTML = h + " : " + m + " : " + s;
9+
10+
}

Week1/HW1/js-exercises/Ex4-time.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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>TIME</title>
8+
</head>
9+
<body>
10+
<div id= "watch"></div>
11+
<script src= "Ex4-showCurrentTime.js"></script>
12+
</body>
13+
</html>
190 KB
Loading
37.7 KB
Loading
27.5 KB
Loading
9.69 KB
Loading

0 commit comments

Comments
 (0)