[thelist] Help with a simple calculation

Jimmy james.glasheen at btinternet.com
Mon Jul 22 12:27:01 CDT 2002


--
[ Picked text/plain from multipart/alternative ]
Can you look at a javascript calculation for me and tell me why it doesn't work?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>apportionment</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type = "text/css">

body {font-family:verdana;}

th {font-size:0.85em;
font-weight:bold;
background-color:#cccccc;
}

td {font-size:0.7em;
font-weight:200;
background-color:#6cf;
}

.but {font-size:0.65em;
font-weight:400;
color:#fff;
background-color:#039;
width:300px;
}

</style>
<script language="JavaScript" type="text/javascript">

function calculate() {

var ppp = document.formula.ppp.value;
var other = document.formula.other.value;
var total = document.formula.total.value;

var x =  ppp / (ppp + other)*total;

x = document.formula.payment.value;

}

</script>
</head>

<body>
  <form name ="formula" action="">

    <table width="300" align="left" cellpadding="2" cellspacing="2">
          <tr>
            <th colspan="2">Apportionment calculator</th>
          </tr>
          <tr>
            <td>PPP healthcare's liability</td>
            <td><input type="text" name="ppp" onchange="calculate();"></td>
          </tr>
          <tr>
            <td>Other insurer's liability</td>
            <td><input type="text" name="other" onchange="calculate();"></td>
          </tr>
          <tr>
            <td>Total admissible expenses</td>
            <td><input type="text" name="total" onchange="calculate();"></td>
          </tr>
          <tr>
            <td colspan="2">
                <input type="button" class="but" value="Calculate" onclick="calculate();">
             </td>
          </tr>
          <tr>
            <td>PPP healthcare's payment</td>
            <td><input type="text" name="payment"></td>
          </tr>
        </table>
  </form>
</body>
</html>

Cheers
--




More information about the thelist mailing list