Skip to content

Commit 6313dfd

Browse files
authored
Add files via upload
1 parent 90e271d commit 6313dfd

File tree

3 files changed

+156
-0
lines changed

3 files changed

+156
-0
lines changed

INDEX.HTML

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
<title>To-Do List</title>
7+
<link rel="stylesheet" href="styles.css">
8+
</head>
9+
<body>
10+
<div class="container">
11+
<h1>My To-Do List</h1>
12+
<input type="text" id="todo-input" placeholder="Add a new task...">
13+
<button id="add-btn">Add Task</button>
14+
<button id="save-btn">Download</button> <!-- New Save button -->
15+
<ul id="todo-list"></ul>
16+
<button href="https://facebook.com/TanvirRamimDM">Facebook</button>
17+
<button href="https://github.com/githubramim">GitHub</button>
18+
<button href="https://x.com/TBFRamim">Twitter</button>
19+
<button href="https://www.linkedin.com/in/tanvir-bin-faruk-ramim-28629b2a6/">Linkedin</button>
20+
<marquee behavior="" direction="">Developed By Tanvir Bin Faruk Ramim </marquee>
21+
</div>
22+
<script src="script.js"></script>
23+
</body>
24+
</html>

script.js

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
document.getElementById('add-btn').addEventListener('click', function() {
2+
const taskInput = document.getElementById('todo-input');
3+
const taskText = taskInput.value.trim();
4+
5+
if (taskText !== '') {
6+
const listItem = document.createElement('li');
7+
listItem.textContent = taskText;
8+
9+
const deleteButton = document.createElement('button');
10+
deleteButton.textContent = 'Delete';
11+
deleteButton.addEventListener('click', function() {
12+
listItem.remove();
13+
});document.getElementById('add-btn').addEventListener('click', function() {
14+
const taskInput = document.getElementById('todo-input');
15+
const taskText = taskInput.value.trim();
16+
17+
if (taskText !== '') {
18+
const listItem = document.createElement('li');
19+
listItem.textContent = taskText;
20+
21+
const deleteButton = document.createElement('button');
22+
deleteButton.textContent = 'Delete';
23+
deleteButton.addEventListener('click', function() {
24+
listItem.remove();
25+
});
26+
27+
listItem.appendChild(deleteButton);
28+
document.getElementById('todo-list').appendChild(listItem);
29+
30+
taskInput.value = '';
31+
} else {
32+
alert('Please enter a task!');
33+
}
34+
});
35+
36+
// Function to save the to-do list as a text file
37+
document.getElementById('save-btn').addEventListener('click', function() {
38+
const tasks = document.querySelectorAll('#todo-list li');
39+
let taskListText = '';
40+
41+
tasks.forEach(task => {
42+
taskListText += task.firstChild.textContent + '\n';
43+
});
44+
45+
const blob = new Blob([taskListText], { type: 'text/plain' });
46+
const link = document.createElement('a');
47+
link.href = URL.createObjectURL(blob);
48+
link.download = 'todo-list.txt'; // Download file name
49+
link.click();
50+
});
51+
52+
53+
listItem.appendChild(deleteButton);
54+
document.getElementById('todo-list').appendChild(listItem);
55+
56+
taskInput.value = '';
57+
} else {
58+
alert('Please enter a task!');
59+
}
60+
});

styles.css

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
body {
2+
margin: 0;
3+
padding: 0;
4+
font-family: Arial, sans-serif;
5+
background: linear-gradient(to right, #5ef031, #2575fc); /* Unique gradient background */
6+
display: flex;
7+
justify-content: center;
8+
align-items: center;
9+
height: 100vh;
10+
}
11+
12+
.container {
13+
background-color: #ffffff;
14+
padding: 20px;
15+
border-radius: 8px;
16+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
17+
width: 300px;
18+
text-align: center;
19+
}
20+
21+
h1 {
22+
color: #333;
23+
margin-bottom: 20px;
24+
}
25+
26+
input[type="text"] {
27+
width: 80%;
28+
padding: 10px;
29+
margin-bottom: 10px;
30+
border: 2px solid #ddd;
31+
border-radius: 4px;
32+
}
33+
34+
button {
35+
padding: 10px;
36+
color: #fff;
37+
background-color: hsl(250, 92%, 33%);
38+
border: none;
39+
border-radius: 4px;
40+
cursor: pointer;
41+
}
42+
43+
button:hover {
44+
background-color: #2575fc;
45+
color: pink;
46+
}
47+
48+
ul {
49+
list-style: none;
50+
padding: 0;
51+
}
52+
53+
li {
54+
padding: 10px;
55+
border-bottom: 1px solid #ddd;
56+
display: flex;
57+
justify-content: space-between;
58+
align-items: center;
59+
}
60+
61+
li button {
62+
background-color: #ff6b6b;
63+
border: none;
64+
color: #fff;
65+
padding: 5px 10px;
66+
border-radius: 4px;
67+
cursor: pointer;
68+
}
69+
70+
li button:hover {
71+
background-color: #ff4757;
72+
}

0 commit comments

Comments
 (0)