Her er den med nulstillingsknap, og for at få decimalerne til at virke, skal du blot bruge punktum isf komma.
<html>
<head>
<script language="JavaScript">
function load()
{
document.f.honorar.focus();
}
function beregn()
{
document.f.resultat.value = (parseInt(document.f.honorar.value) +
parseInt(document.f.anvendt.value) -
parseInt(document.f.udleveret.value) -
parseInt(document.f.selvrisiko.value)) *
parseFloat(document.f.daekning.value);
}
function nulstil()
{
document.f.honorar.value = '';
document.f.anvendt.value = '';
document.f.udleveret.value = '';
document.f.selvrisiko.value = '';
document.f.daekning.value = '';
document.f.resultat.value = '';
}
</script>
</head>
<body onload="load();">
Beregning af forsikringsudbetaling
http://www.eksperten.dk/spm/300677<br><br><form name="f">
<table>
<tr> <!-- Row 1 -->
<td> <!-- Row,Col 1,1 -->
1. Indtast samlet honorar
</td>
<td> <!-- Row,Col 1,2 -->
<input type=text name=honorar>
</td>
</tr>
<tr> <!-- Row 2 -->
<td> <!-- Row,Col 2,1 -->
2. Indtast samlet anvendt materiale og medicin forbrug
</td>
<td> <!-- Row,Col 2,2 -->
<input type=text name=anvendt>
</td>
</tr>
<tr> <!-- Row 3 -->
<td> <!-- Row,Col 3,1 -->
3. Indtast samlet udleveret materiale og medicin
</td>
<td> <!-- Row,Col 3,2 -->
<input type=text name=udleveret>
</td>
</tr>
<tr> <!-- Row 4 -->
<td> <!-- Row,Col 4,1 -->
4. Indtast selvrisiko
</td>
<td> <!-- Row,Col 4,2 -->
<input type=text name=selvrisiko>
</td>
</tr>
<tr> <!-- Row 5 -->
<td> <!-- Row,Col 5,1 -->
5. Indtast dækningsgrad (brug decimalPUNKTUM, eks: 0.8)
</td>
<td> <!-- Row,Col 5,2 -->
<input type=text name=daekning>
</td>
</tr>
<tr> <!-- Row 6 -->
<td> <!-- Row,Col 6,1 -->
6. Resultat
</td>
<td> <!-- Row,Col 6,2 -->
<input type=text name=resultat>
</td>
</tr>
</table>
<input type=button value="Beregn" onclick="beregn();"><br>
<input type=button value="Nulstil" onclick="nulstil();">
</form>
</body>
</html>
Mvh
Jesper Naur