<html>
<head>
<script type="text/javascript">
var kg=true;
function getval(val){
if(!kg){
document.getElementById('res').value='';
kg=true;
}
document.getElementById('res').value+=val;
}
function getres(val){
var as=document.getElementById('res').value;
as=eval(as);
document.getElementById('res').value=as;
kg=false;
}
</script>
</head>
<body>
<table border='1px' width='220px'>
<tr colspan='4'>
<input type='text' id='res' size='42'>
</tr>
<tr>
<td><input type='button' value='1' style="width:70px;" οnclick="getval(1)"></td>
<td><input type='button' value='2' style="width:70px;" οnclick="getval(2)"/></td>
<td><input type='button' value='3' style="width:70px;" οnclick="getval(3)"/></td>
<td><input type='button' value='+' style="width:70px;" οnclick="getval('+')"/></td>
</tr>
<tr>
<td><input type='button' value='4' style="width:70px;" οnclick="getval(4)"></td>
<td><input type='button' value='5' style="width:70px;" οnclick="getval(5)"/></td>
<td><input type='button' value='6' style="width:70px;" οnclick="getval(6)"/></td>
<td><input type='button' value='-' style="width:70px;" οnclick="getval('-')"/></td>
</tr>
<tr>
<td><input type='button' value='7' style="width:70px;" οnclick="getval(7)"></td>
<td><input type='button' value='8' style="width:70px;" οnclick="getval(8)"/></td>
<td><input type='button' value='9' style="width:70px;" οnclick="getval(9)"/></td>
<td><input type='button' value='*' style="width:70px;" οnclick="getval('*')"/></td>
</tr>
<tr>
<td><input type='button' value='0' style="width:70px;" οnclick="getval(0)"></td>
<td><input type='button' value='.' style="width:70px;" οnclick="getval(.)"/></td>
<td><input type='button' value='=' style="width:70px;" οnclick="getres('=')"/></td>
<td><input type='button' value='/' style="width:70px;" οnclick="getval('/')"/></td>
</tr>
</table>
</body>
</html>