Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>To-Do List</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="container">
<h1>To-Do List</h1>
<input type="text" id="taskInput" placeholder="Add a new task...">
<button id="addButton">Add</button>
<ul id="taskList"></ul>
</div>
<script src="script.js"></script>
</body>
</html>
36 changes: 36 additions & 0 deletions index2.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Simple Calculator</title>
<link rel="stylesheet" href="styles2.css">
</head>
<body>
<div class="calculator">
<input type="text" id="display" disabled>
<div class="buttons">
<button onclick="clearDisplay()">C</button>
<button onclick="appendToDisplay('7')">7</button>
<button onclick="appendToDisplay('8')">8</button>
<button onclick="appendToDisplay('9')">9</button>
<button onclick="appendToDisplay('/')">/</button>

<button onclick="appendToDisplay('4')">4</button>
<button onclick="appendToDisplay('5')">5</button>
<button onclick="appendToDisplay('6')">6</button>
<button onclick="appendToDisplay('*')">*</button>

<button onclick="appendToDisplay('1')">1</button>
<button onclick="appendToDisplay('2')">2</button>
<button onclick="appendToDisplay('3')">3</button>
<button onclick="appendToDisplay('-')">-</button>

<button onclick="appendToDisplay('0')">0</button>
<button onclick="calculateResult()">=</button>
<button onclick="appendToDisplay('+')">+</button>
</div>
</div>
<script src="script2.js"></script>
</body>
</html>
Binary file added project report.docx
Binary file not shown.
29 changes: 29 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
document.addEventListener('DOMContentLoaded', () => {
const taskInput = document.getElementById('taskInput');
const addButton = document.getElementById('addButton');
const taskList = document.getElementById('taskList');

addButton.addEventListener('click', () => {
const taskText = taskInput.value.trim();
if (taskText === '') return;

const listItem = document.createElement('li');
listItem.textContent = taskText;

const removeButton = document.createElement('button');
removeButton.textContent = 'Remove';
removeButton.addEventListener('click', () => {
taskList.removeChild(listItem);
});

listItem.appendChild(removeButton);
taskList.appendChild(listItem);
taskInput.value = '';
});

taskInput.addEventListener('keypress', (event) => {
if (event.key === 'Enter') {
addButton.click();
}
});
});
18 changes: 18 additions & 0 deletions script2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
function appendToDisplay(value) {
const display = document.getElementById('display');
display.value += value;
}

function clearDisplay() {
const display = document.getElementById('display');
display.value = '';
}

function calculateResult() {
const display = document.getElementById('display');
try {
display.value = eval(display.value);
} catch (error) {
display.value = 'Error';
}
}
64 changes: 64 additions & 0 deletions styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 20px;
}

.container {
max-width: 400px;
margin: auto;
background: white;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

h1 {
text-align: center;
}

input {
width: 70%;
padding: 10px;
margin-right: 10px;
border: 1px solid #ccc;
border-radius: 4px;
}

button {
padding: 10px;
background: #28a745;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
}

button:hover {
background: #218838;
}

ul {
list-style-type: none;
padding: 0;
}

li {
display: flex;
justify-content: space-between;
padding: 10px;
border-bottom: 1px solid #ccc;
}

li button {
background: #dc3545;
border: none;
color: white;
border-radius: 4px;
cursor: pointer;
}

li button:hover {
background: #c82333;
}
52 changes: 52 additions & 0 deletions styles2.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}

.calculator {
background: white;
border-radius: 8px;
padding: 20px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
width: 250px;
}

#display {
width: 100%;
padding: 10px;
font-size: 24px;
margin-bottom: 10px;
border: 1px solid #ccc;
border-radius: 4px;
text-align: right;
}

.buttons {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 10px;
}

button {
padding: 20px;
font-size: 18px;
border: none;
border-radius: 4px;
background: #007bff;
color: white;
cursor: pointer;
transition: background 0.3s;
}

button:hover {
background: #0056b3;
}

button:active {
background: #004494;
}