mirror of
https://github.com/milk-net/milk-net.github.io.git
synced 2025-04-19 21:53:40 -05:00
Create index.html
This commit is contained in:
parent
f92d1552cc
commit
d271b2514c
1 changed files with 92 additions and 0 deletions
92
calculator/index.html
Normal file
92
calculator/index.html
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>MilkNet | Calculator</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
height: 100vh;
|
||||||
|
background-color: #000;
|
||||||
|
}
|
||||||
|
.calculator {
|
||||||
|
background: #000;
|
||||||
|
color: #fff;
|
||||||
|
padding: 20px;
|
||||||
|
border-radius: 10px;
|
||||||
|
box-shadow: 0px 0px 10px rgba(255, 255, 255, 0.2);
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
input {
|
||||||
|
width: 100%;
|
||||||
|
height: 50px;
|
||||||
|
text-align: right;
|
||||||
|
font-size: 1.5em;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
background: #222;
|
||||||
|
color: #fff;
|
||||||
|
border: none;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
.buttons {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(4, 1fr);
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
button {
|
||||||
|
padding: 15px;
|
||||||
|
font-size: 1.2em;
|
||||||
|
border: none;
|
||||||
|
background: #333;
|
||||||
|
color: #fff;
|
||||||
|
cursor: pointer;
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
button:hover {
|
||||||
|
background: #555;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="calculator">
|
||||||
|
<input type="text" id="display" disabled>
|
||||||
|
<div class="buttons">
|
||||||
|
<button onclick="clearDisplay()">C</button>
|
||||||
|
<button onclick="appendToDisplay('/')">/</button>
|
||||||
|
<button onclick="appendToDisplay('*')">*</button>
|
||||||
|
<button onclick="appendToDisplay('-')">-</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="calculateResult()">=</button>
|
||||||
|
<button onclick="appendToDisplay('1')">1</button>
|
||||||
|
<button onclick="appendToDisplay('2')">2</button>
|
||||||
|
<button onclick="appendToDisplay('3')">3</button>
|
||||||
|
<button onclick="appendToDisplay('0')">0</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
function appendToDisplay(value) {
|
||||||
|
document.getElementById('display').value += value;
|
||||||
|
}
|
||||||
|
function clearDisplay() {
|
||||||
|
document.getElementById('display').value = '';
|
||||||
|
}
|
||||||
|
function calculateResult() {
|
||||||
|
try {
|
||||||
|
document.getElementById('display').value = eval(document.getElementById('display').value);
|
||||||
|
} catch (e) {
|
||||||
|
alert('Invalid Expression');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Add table
Reference in a new issue