<!DOCTYPE html>
<html>
<head>
	<title>Calculator</title>
	<script>
		function addDigit(digit) {
			var resultField = document.getElementById("result");
			resultField.value += digit;
		}
		
		function calculate() {
			var calculation = document.getElementById("result").value;
			var resultField = document.getElementById("result");
			if(calculation) {
				try {
					resultField.value = eval(calculation);
				} catch(error) {
					resultField.value = "Error";
				}
			} else {
				resultField.value = "";
			}
		}
		
		function clearResult() {
			var resultField = document.getElementById("result");
			resultField.value = "";
		}
	</script>
</head>
<body>
	<h2>Calculator</h2>
	<input type="text" id="result" readonly><br><br>
	<button onclick="addDigit('1')">1</button>
	<button onclick="addDigit('2')">2</button>
	<button onclick="addDigit('3')">3</button>
	<button onclick="addDigit('+')">+</button><br><br>
	<button onclick="addDigit('4')">4</button>
	<button onclick="addDigit('5')">5</button>
	<button onclick="addDigit('6')">6</button>
	<button onclick="addDigit('-')">-</button><br><br>
	<button onclick="addDigit('7')">7</button>
	<button onclick="addDigit('8')">8</button>
	<button onclick="addDigit('9')">9</button>
	<button onclick="addDigit('*')">×</button><br><br>
	<button onclick="clearResult()">C</button>
	<button onclick="addDigit('0')">0</button>
	<button onclick="addDigit('.')">.</button>
	<button onclick="addDigit('/')">÷</button><br><br>
	<button onclick="calculate()">=</button>
</body>
</html>

Please ch