body {
font-family: Arial, sans-serif;
text-align: center;
margin: 50px;
}
input[type=”text”] {
width: 200px;
padding: 10px;
font-size: 18px;
margin-bottom: 10px;
}
input[type=”button”] {
width: 50px;
height: 50px;
font-size: 18px;
margin: 5px;
}
Simple Calculator
function appendToDisplay(value) {
document.getElementById(‘display’).value += value;
}
function calculate() {
try {
document.getElementById(‘display’).value = eval(document.getElementById(‘display’).value);
} catch (error) {
document.getElementById(‘display’).value = ‘Error’;
}
}
function clearDisplay() {
document.getElementById(‘display’).value = ”;
}