<!DOCTYPE html>
<html>
<head>
<title>calculator2019_08_03</title>
<meta charset="utf-8">
</head>
<body>
Enter first number<input type="text" id="t1"><br>
Enter second number<input type="text" id="t2"><br>
<input type="text" id="t3"><br>
<button id="b1">+</button>
<button id="b2">-</button>
<button id="b3">*</button>
<button id="b4">/</button>
</body>
<script>
var t1=document.querySelector('#t1');
var t2=document.querySelector('#t2');
var t3=document.querySelector('#t3');
var b1=document.querySelector('#b1');
var b2=document.querySelector('#b2');
var b3=document.querySelector('#b3');
var b4=document.querySelector('#b4');
b1.onclick=function(){
t3.value=+t1.value+ +t2.value;
document.getElementById('#t3');
}
b2.onclick=function(){
t3.value=+t1.value- +t2.value;
document.getElementById('#t3');
}
b3.onclick=function(){
t3.value=+t1.value* +t2.value;
document.getElementById('#t3');
}
b4.onclick=function(){
if(t2.value!=0){
t3.value=+t1.value/ +t2.value;
}
else t3.value="error";
document.getElementById('#t3');
}
</script>
</html>