-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathto-do-list.html
More file actions
48 lines (48 loc) · 1.16 KB
/
Copy pathto-do-list.html
File metadata and controls
48 lines (48 loc) · 1.16 KB
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
<!DOCTYPE html>
<html>
<head>
<title>To-do list | rowannerd</title>
<style>
body {
font-family: sans-serif;
height: 100px;
background-color: rgb (0, 255, 250);
}
button {
background-color: red;
height: 50px;
color: white;
}
button:hover {
background-color: black;
}
</style>
</head>
<body>
<p>Text Here: </p>
<input type="text" id="text">
<button onclick="myFunction()">Change Text</button>
<input type="text" id="do" value="">
<button onclick="deletestuff()">Delete</button>
<div id="display"></div>
<script>
var text = [];
var input = 0;
var deletein = 0;
function add(id, value) {
document.getElementById(id).innerHTML = value;
}
function myFunction() {
input = document.getElementById("text").value;
text.push("<br>" + input);
add("display", text);
}
function deletestuff() {
deletein = document.getElementById("do").value;
text.splice(deletein - 1, 1);
add("display", text);
}
add("display", text);
</script>
</body>
</html>