<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
<!--
function init() {
document.formInput.num1.focus();
document.formInput.num1.value=0;
document.formInput.num2.value=0;
document.formInput.total.value=0;
}
function c() {
var total="";
var num1;
var num2;
num1= parseInt(document.formInput.num1.value);
num2= parseInt(document.formInput.num2.value);
total= num1+num2;
document.formInput.total.value= total;
}
-->
</script>
</head>
<body onload="init();">
<form name="formInput" action="">
<table border=1>
<caption><ins>Simple Addition calculator</ins></caption></br>
<tr>
<th>Number1</th>
<th>Number2</th>
<th>Total</th>
</tr>
<tr>
<td><input type="text" size="10" name="num1" onchange="c();"></td>
<td><input type="text" size="10" name="num2" onchange="c();"></td>
<td><input type="text" size="10" name="total" disabled="disabled"></td>
</tr>
</table>
</form>
</body>
</html>
No comments:
Post a Comment