Widget:CrCl: Difference between revisions
No edit summary |
No edit summary |
||
Line 4: | Line 4: | ||
var creat = document.creat.c.value; |
var creat = document.creat.c.value; |
||
var weight = document.creat.w.value; |
var weight = document.creat.w.value; |
||
var creat_units = document.creat.csel.value; |
|||
var weight_units = document.creat.wsel.value; |
|||
var sex = document.creat.sex.value; |
var sex = document.creat.sex.value; |
||
Line 9: | Line 11: | ||
return; |
return; |
||
var crcl = 1.2 * (140 - age) * weight / creat; |
var crcl = 1.2 * (140 - age) * (weight * weight_units) / (creat * creat_units); |
||
if (sex == "Female") crcl = crcl * 0.85; |
if (sex == "Female") crcl = crcl * 0.85; |
||
if (crcl < 0) crcl = 0; |
if (crcl < 0) crcl = 0; |
||
Line 19: | Line 21: | ||
<div class="mline"> |
<div class="mline"> |
||
<div class="mleft">Age:</div> |
<div class="mleft">Age:</div> |
||
<div class="mmiddle"> |
<div class="mmiddle"><input autocomplete="off" onkeyup="calcreat()" name="a"></div> |
||
<input autocomplete=off class="forminputcontent" onkeyup="calcreat()" name=a> |
|||
</div> |
|||
<div class="mright">Years</div> |
<div class="mright">Years</div> |
||
</div> |
</div> |
||
Line 28: | Line 28: | ||
<div class="mmiddle"> |
<div class="mmiddle"> |
||
<select name=sex> |
<select name=sex> |
||
<option selected>Male</option> |
<option value="1" selected>Male</option> |
||
<option>Female</option> |
<option value="0.85">Female</option> |
||
</select> |
</select> |
||
</div> |
</div> |
||
Line 40: | Line 40: | ||
<div class="mright"> |
<div class="mright"> |
||
<select name=wsel> |
<select name=wsel> |
||
<option value= |
<option value="1" selected>kg</option> |
||
<option value= |
<option value="0.4536">lbs</option> |
||
</select> |
</select> |
||
</div> |
</div> |
||
Line 52: | Line 52: | ||
<div class="mright"> |
<div class="mright"> |
||
<select name=csel> |
<select name=csel> |
||
<option value= |
<option value=88>mg/dL</option> |
||
<option value= |
<option value=1 selected>umol/L</option> |
||
</select> |
</select> |
||
</div> |
</div> |
Revision as of 21:01, 15 August 2019
<script type="text/javascript"> function calcreat() { var age = document.creat.a.value; var creat = document.creat.c.value; var weight = document.creat.w.value; var creat_units = document.creat.csel.value; var weight_units = document.creat.wsel.value; var sex = document.creat.sex.value;
if (age=="" || weight=="" || creat=="") return;
var crcl = 1.2 * (140 - age) * (weight * weight_units) / (creat * creat_units); if (sex == "Female") crcl = crcl * 0.85; if (crcl < 0) crcl = 0; document.creat.res.value = crcl; } </script> <form name="creat" style="font-size:80%">
<select name=sex> <option value="1" selected>Male</option> <option value="0.85">Female</option> </select>
<input autocomplete=off onkeyup="calcreat()" name=w>
<select name=wsel> <option value="1" selected>kg</option> <option value="0.4536">lbs</option> </select>
<input autocomplete=off onkeyup="calcreat()" name=c>
<select name=csel> <option value=88>mg/dL</option> <option value=1 selected>umol/L</option> </select>
<input ReadOnly name="res" style="color:red;background-color:#cccccc">
<input onclick="calcreat()" type="button" value="Calculate" />
</form>