1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
<html>
<head>
<title>Document sans titre</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
<!--
function addition()
{
var sum = ''; num1 = 0; num2 = 0; num3 = 0; num4 = 0; num5 = 0;
if (document.getElementById('num1').value != '')
{
num1 = eval(document.getElementById('num1').value);
}
if (document.getElementById('num2').value != '')
{
num2 = eval(document.getElementById('num2').value);
}
if (document.getElementById('num3').value != '')
{
num3 = eval(document.getElementById('num3').value);
}
if (document.getElementById('num4').value != '')
{
num4 = eval(document.getElementById('num4').value);
}
if (document.getElementById('num5').value != '')
{
num5 = eval(document.getElementById('num5').value);
}
sum = num1 - num2 - num3 - num4 - num5
document.getElementById('somme').value = eval(sum);
}
//-->
</script>
</head>
<body>
<form name="form1" method="post" action="">
<table align="center" width="25%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input type="text" name="num1" id="num1" onBlur="addition();"></td>
</tr>
<tr>
<td><input type="text" name="num2" id="num2" onBlur="addition();"></td>
</tr>
<tr>
<td><input type="text" name="num3" id="num3" onBlur="addition();"></td>
</tr>
<tr>
<td><input type="text" name="num4" id="num4" onBlur="addition();"></td>
</tr>
<tr>
<td><input type="text" name="num5" id="num5" onBlur="addition();"></td>
</tr>
<tr>
<td><input type="text" name="somme" id="somme" onBlur="addition();"></td>
</tr>
</table>
</form>
<form name="form1" method="post" action="">
<table align="center" width="25%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input type="text" name="num1" id="num1" onBlur="addition();"></td>
</tr>
<tr>
<td><input type="text" name="num2" id="num2" onBlur="addition();"></td>
</tr>
<tr>
<td><input type="text" name="num3" id="num3" onBlur="addition();"></td>
</tr>
<tr>
<td><input type="text" name="num4" id="num4" onBlur="addition();"></td>
</tr>
<tr>
<td><input type="text" name="num5" id="num5" onBlur="addition();"></td>
</tr>
<tr>
<td><input type="text" name="somme" id="somme" onBlur="addition();"></td>
</tr>
</table>
</form>
</body>
</html> |
Partager