forked from biratdatta/Webpage-Maker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ToDo.html
164 lines (134 loc) · 4.28 KB
/
ToDo.html
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
156
157
158
159
160
161
162
163
164
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link href="https://fonts.googleapis.com/css2?family=Heebo:wght@500&family=Source+Code+Pro:wght@200&display=swap"
rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300&display=swap" rel="stylesheet">
<link
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Thai+Looped:wght@600&family=Roboto:wght@300&display=swap"
rel="stylesheet">
<title>TODO App</title>
</head>
<style>
body {
background-image: linear-gradient(to right, rgb(77, 1, 77), rgb(243, 149, 165));
}
.header {
font-family: 'Heebo', sans-serif;
margin: 150px 350px 450px 350px;
padding: 10px 10px;
padding-bottom: 30px;
background-color: rgb(244, 247, 250);
text-align: center;
border: 2px solid black;
width: 400px;
box-shadow: black;
}
.tasks {
font-family: 'Heebo', sans-serif;
font-size: 15px;
width: 80%;
padding: 10px 5px;
height: 12px;
}
.btn2 {
font-family: 'Heebo', sans-serif;
width: 47px;
height: 33px;
background-color: rgb(160, 160, 160);
}
.btn2:hover {
background: rgb(70, 67, 67);
}
.todo{
text-align: left;
cursor:pointer;
display: inline-block;
background-color: aliceblue;
position: absolute;
padding: 15px;
top: 369px;
border: 2px solid black;
left: 358px;
width:390px;
height:250px;
overflow: auto;
}
.paragraph-styling {
cursor: pointer;
padding:5px;
}
.paragraph-styling:hover{
background-color: rgb(95, 93, 93);
}
#outer{
color:white;
text-align: center;
font-size: 25px;
background-color: black;
padding: 0px;
margin:0px;
}
#outertime{
color:white;
text-align: center;
font-size: 15px;
background-color: black;
}
#close{
background-color: rgb(190, 188, 188);
font-family: 'Heebo', sans-serif;
margin: 3px;
cursor:pointer;
}
#close:hover{
background-color: rgb(133, 124, 124);
}
</style>
<body>
<p id="outer">Welcome User!</p>
<p id="outertime"></p>
<div class="header">
<h1>TO-DO List</h1>
<input type="text" id="task" class="tasks" placeholder="Task...">
<button id="add" class="btn2">ADD</button>
<div class="todo" id="addingtodo">
</div>
<div class="CLOSE" id="close">
</div>
</div>
<script>
const date= new Date();
document.getElementById('outertime').innerHTML=date;
var addbtn = document.getElementById('add');
var addingtodo = document.getElementById('addingtodo');
var task = document.getElementById('task');
// var btn= document.createElement("button");
// btn.innerHTML="delete";
addbtn.addEventListener('click', function () {
var paragraph = document.createElement('p');
paragraph.classList.add('paragraph-styling');
paragraph.innerText = task.value;
addingtodo.appendChild(paragraph); /* Adding element to our list*/
task.value="";
paragraph.addEventListener('click',function(){
paragraph.style.textDecoration="line-through"; /*Single click produces a single line
on element, indicating that task is
complete*/
});
var button= document.createElement("button");
button.innerHTML="delete";
button.id="close";
addingtodo.appendChild(button);/*Appedning a delete button to each element*/
button.addEventListener('click',function(){
addingtodo.removeChild(paragraph);
button.style.visibility="hidden";/*HIddening delete button after deleteing element*/
}
);
});
</script>
</body>
</html>