Skip to content

Commit c8792d1

Browse files
author
daniel2231
committed
Landing page has been added
1 parent e8fd046 commit c8792d1

File tree

3 files changed

+33
-28
lines changed

3 files changed

+33
-28
lines changed

index.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ <h2 class="greeting" id="greeting"></h2>
2222

2323
<div class="accomplishInput">
2424
<form>
25-
<h3>I am planning to accomplish<input type="text" id="goal">today!</h3>
25+
<h3>I am planning to accomplish<input type="text" id="input">today!</h3>
2626
</form>
2727
</div>
2828
<div class="toDo">
29-
<ol id="toDoList">
30-
</ol>
29+
<ul id="list">
30+
</ul>
3131
</div>
3232
<script src="main.js"></script>
3333
</body>

main.css

+12-7
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,8 @@ form {
5959
margin-top: 120px;
6060
margin-bottom: -10px;
6161
}
62-
.accomplishInput {
63-
display: flex;
64-
justify-content: center;
65-
align-content: center;
66-
}
67-
#goal {
62+
63+
#input {
6864
border: none;
6965
border-bottom: 2px solid white;
7066
background: none;
@@ -86,9 +82,18 @@ body {
8682

8783
li {
8884
font-family: 'Open Sans', sans-serif;
89-
text-align: left;
85+
text-align: center;
9086
font-size: 30px;
9187
list-style: none;
9288
margin: 0;
9389
color: white;
90+
position: fixed;
9491
}
92+
93+
.accomplishInput {
94+
display: flex;
95+
align-items: center;
96+
justify-items: center;
97+
flex-direction: column;
98+
text-align: center;
99+
}

main.js

+18-18
Original file line numberDiff line numberDiff line change
@@ -64,22 +64,22 @@ function checkTime(i) {
6464
}
6565

6666
//TodoList
67-
function newList() {
68-
var item = document.getElementById("goal").value;
69-
var ol = document.getElementById("toDoList");
70-
var li = document.createElement("li");
71-
li.appendChild(document.createTextNode("- " + item));
72-
ol.appendChild(li);
73-
document.getElementById("goal").value = "";
74-
li.onclick = removeItem;
67+
function newItem() {
68+
var item = document.getElementById('input').value;
69+
var ul = document.getElementById("list");
70+
var li = document.createElement('li');
71+
li.appendChild(document.createTextNode("- "+item));
72+
ul.appendChild(li);
73+
document.getElementById('input').value="";
74+
li.onclick = removeItem;
75+
}
76+
77+
document.body.onkeyup = function(e){
78+
if(e.keyCode == 13){
79+
newItem();
80+
}
7581
}
76-
77-
document.body.onkeyup = function(e) {
78-
if (e.keyCode == 13) {
79-
newList();
80-
}
81-
};
82-
83-
function removeItem(e) {
84-
e.target.parentElement.removeChild(e.target);
85-
}
82+
83+
function removeItem(e) {
84+
e.target.parentElement.removeChild(e.target);
85+
}

0 commit comments

Comments
 (0)