Skip to content

Commit bd97da2

Browse files
committed
Full commit
1 parent 8f6ab83 commit bd97da2

File tree

30 files changed

+892
-0
lines changed

30 files changed

+892
-0
lines changed
14.7 KB
Loading
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
function addItem() {
2+
let inputField = document.querySelector('#newItemText');
3+
let listItems = document.querySelector('ul');
4+
5+
let newElement = document.createElement('li');
6+
newElement.textContent = inputField.value;
7+
listItems.appendChild(newElement);
8+
inputField.value = '';
9+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!--Problems for in-class lab for the “JavaScript Advanced” course @ SoftUni.
2+
Submit your solutions in the SoftUni judge system at https://judge.softuni.org/Contests/2762/DOM-Manipulation-and-Events-Lab -->
3+
4+
<!DOCTYPE html>
5+
<html lang="en">
6+
7+
<head>
8+
<meta charset="UTF-8">
9+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
10+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
11+
<link rel="stylesheet" href="style.css">
12+
<title>List of Items</title>
13+
</head>
14+
15+
<body>
16+
<h1>List of Items</h1>
17+
<main>
18+
<ul id="items">
19+
<li>First</li>
20+
<li>Second</li>
21+
</ul>
22+
<input type="text" id="newItemText" />
23+
<input type="button" value="Add" onclick="addItem()">
24+
</main>
25+
</body>
26+
<script src="./app.js"></script>
27+
28+
</html>
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
body {
2+
background: #eeeeee;
3+
font-family: "Source Code Pro", monospace;
4+
}
5+
6+
body > h1 {
7+
text-align: left;
8+
background: #50b9b9;
9+
color: white;
10+
padding: 10px 20px;
11+
border-radius: 10px 10px 0 0;
12+
width: 250px;
13+
margin: 0 auto;
14+
font-size: 24px;
15+
}
16+
17+
ul {
18+
margin-top: 5px;
19+
}
20+
21+
li {
22+
background-color: white;
23+
padding: 7px;
24+
border-radius: 13px;
25+
margin-bottom: 5px;
26+
list-style-type: none;
27+
margin-left: -37px;
28+
}
29+
30+
#items li a {
31+
color: red;
32+
text-decoration: none;
33+
margin-left: 10px;
34+
}
35+
36+
main {
37+
background: #91a29f;
38+
width: 259px;
39+
margin: 0 auto;
40+
padding: 1rem;
41+
border-radius: 0 0 10px 10px;
42+
}
43+
44+
main input[type="text"] {
45+
border: 1px solid black;
46+
border-radius: 14px;
47+
padding: 5px;
48+
font-size: 19px;
49+
outline: none;
50+
cursor: pointer;
51+
width: 140px;
52+
}
53+
54+
main input[type="button"] {
55+
border: 1px solid;
56+
background: #eeeeee;
57+
58+
font-size: 14px;
59+
border-radius: 14px;
60+
font-weight: bold;
61+
text-transform: uppercase;
62+
text-align: center;
63+
letter-spacing: 0px;
64+
outline: none;
65+
display: inline-block;
66+
padding: 8px;
67+
border: 1px solid black;
68+
border-radius: 10px;
69+
box-shadow: 0 2px 1px rgba(0, 0, 0, 0.2), inset 0 2px 1px rgba(0, 0, 0, 0.2);
70+
width: 50px;
71+
}
72+
73+
main input[type="button"]:hover {
74+
border-color: white;
75+
background-color: #91a29f;
76+
color: white;
77+
}
57.9 KB
Loading
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
function deleteByEmail() {
2+
let inputField = document.querySelector('input[type=text]');
3+
let resultField = document.querySelector('#result');
4+
let emails = document.querySelectorAll('td:nth-child(2)');
5+
6+
for (const email of emails) {
7+
if (email.textContent.includes(inputField.value)) {
8+
email.parentNode.remove();
9+
resultField.textContent = "Deleted.";
10+
break;
11+
}
12+
else {
13+
resultField.textContent = "Not found.";
14+
}
15+
}
16+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<!--Problems for in-class lab for the “JavaScript Advanced” course @ SoftUni.
2+
Submit your solutions in the SoftUni judge system at https://judge.softuni.org/Contests/2762/DOM-Manipulation-and-Events-Lab -->
3+
4+
<!DOCTYPE html>
5+
<html lang="en">
6+
7+
<head>
8+
<meta charset="UTF-8">
9+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
10+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
11+
<link rel="stylesheet" href="style.css">
12+
<title>Delete from Table</title>
13+
</head>
14+
15+
<body>
16+
<table border="1" id="customers">
17+
<thead>
18+
<tr>
19+
<th>Name</th>
20+
<th>Email</th>
21+
</tr>
22+
</thead>
23+
<tbody>
24+
<tr>
25+
<td>Eve</td>
26+
<td>eve@gmail.com</td>
27+
</tr>
28+
<tr>
29+
<td>Nick</td>
30+
<td>nick@yahooo.com</td>
31+
</tr>
32+
<tr>
33+
<td>Didi</td>
34+
<td>didi@didi.net</td>
35+
</tr>
36+
<tr>
37+
<td>Tedy</td>
38+
<td>tedy@tedy.com</td>
39+
</tr>
40+
</tbody>
41+
</table>
42+
<label>
43+
Email: <input type="text" name="email" />
44+
<button onclick="deleteByEmail()">Delete</button>
45+
</label>
46+
<div id="result"></div>
47+
<script src="./app.js"></script>
48+
</body>
49+
50+
</html>
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
* {
2+
margin: 0;
3+
padding: 0;
4+
box-sizing: border-box;
5+
}
6+
7+
body {
8+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
9+
color: #333;
10+
}
11+
12+
table {
13+
text-align: left;
14+
line-height: 40px;
15+
border-collapse: separate;
16+
border-spacing: 0;
17+
border: 2px solid #ed1c40;
18+
width: 500px;
19+
margin: 50px auto;
20+
border-radius: .25rem;
21+
}
22+
23+
th {
24+
border: none;
25+
}
26+
27+
thead tr:first-child {
28+
background: #ed1c40;
29+
color: #fff;
30+
border: none;
31+
}
32+
33+
th,
34+
td {
35+
padding: 0 15px 0 20px;
36+
}
37+
38+
th {
39+
font-weight: 500;
40+
}
41+
42+
tbody tr:hover {
43+
background-color: #f2f2f2;
44+
cursor: default;
45+
}
46+
47+
.button {
48+
color: #aaa;
49+
cursor: pointer;
50+
vertical-align: middle;
51+
margin-top: -4px;
52+
}
53+
54+
.edit:hover {
55+
color: #0a79df;
56+
}
57+
58+
.delete:hover {
59+
color: #dc2a2a;
60+
}
61+
62+
label {
63+
margin-left: 34%;
64+
font-size: 20px;
65+
}
66+
67+
input[type="text"] {
68+
border-radius: 4px;
69+
padding: 7px 5px;
70+
border: 1px solid gray;
71+
font-size: 18px;
72+
outline: none;
73+
}
74+
75+
button {
76+
background: #ed1c40;
77+
border: #ed1c40;
78+
border-radius: 4px;
79+
padding: 6px 10px;
80+
font-size: 20px;
81+
color: white;
82+
font-weight: bold;
83+
text-transform: uppercase;
84+
cursor: pointer;
85+
outline: none;
86+
}
87+
88+
#result {
89+
text-align: center;
90+
}
28.6 KB
Loading
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
function addItem() {
2+
let inputField = document.querySelector('#newItemText');
3+
let listItems = document.querySelector('ul');
4+
5+
let listElement = document.createElement('li');
6+
listElement.textContent = inputField.value;
7+
8+
let linkElement = document.createElement('a');
9+
linkElement.setAttribute('href', '#');
10+
linkElement.textContent = "[Delete]";
11+
12+
listElement.appendChild(linkElement);
13+
listItems.appendChild(listElement);
14+
15+
linkElement.addEventListener('click', function(event){
16+
event.currentTarget.parentNode.remove();
17+
})
18+
19+
inputField.value = '';
20+
}

0 commit comments

Comments
 (0)