Widget:CrCl: Difference between revisions

From IDWiki
(Created page with "<script type="text/javascript"> function calcreat() { //alert('good'); var a = document.creat.a.value; var c = document.creat.c.value; var w = document.creat.w.value; var wsel...")
 
No edit summary
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
<script type="text/javascript">
<script type="text/javascript">
function calcreat()
function calc_crcl() {
var age = document.crcl.a.value;
{
var creat = document.crcl.c.value;
//alert('good');
var a = document.creat.a.value;
var weight = document.crcl.w.value;
var c = document.creat.c.value;
var creat_units = document.crcl.csel.value;
var w = document.creat.w.value;
var weight_units = document.crcl.wsel.value;
var wsel = document.creat.wsel.value;
var sex = document.crcl.sex.value;

var csel = document.creat.csel.value;
if (age=="" || weight=="" || creat=="")
var sex = document.creat.sex.value;
return;
//alert(w);

if (a=="" || w=="" || c=="")
var crcl = 1.2 * (140 - age) * (weight * weight_units) / (creat * creat_units) * sex;
{return;}
else
if (crcl < 10) document.crcl.res.value = "< 10";
{
else document.crcl.res.value = Math.floor(crcl);
if (sex == "Female")
var ret = (140 - a) * w * wsel * 0.85 / (72 * c * csel);
else
var ret = (140 - a) * w * wsel / (72 * c * csel);
ret = ret.toFixed(8);
if (ret < 0) ret = 0;
document.creat.res.value=ret;
}
}
function isNum(args)
{
args = args.toString();
if (args.length == 0)
return false;
for (var i = 0; i<args.length; i++)
{
if ((args.substring(i,i+1) < "0" || args.substring(i, i+1) > "9") && args.substring(i, i+1) != ".")
{
return false;
}
}
return true;
}
function creatcheck(p)
{
var a = document.creat.a.value;
var c = document.creat.c.value;
var w = document.creat.w.value;
//alert(m);
if (p == "1" && !isNum(a))
{
a = a.substring(0,a.length-1);
document.creat.a.value = a;
return;
}
if (p == "3" && !isNum(c))
{
c = c.substring(0,c.length-1);
document.creat.c.value = c;
return;
}
if (p == "2" && !isNum(w))
{
w = w.substring(0,w.length-1);
document.creat.w.value = w;
return;
}
}
function creatclear()
{
document.creat.a.value = '';
document.creat.c.value = '';
document.creat.w.value = '';
document.creat.res.value = '';
document.creat.a.focus();
}
}
</script>
</script>
<form name="crcl" style="font-size:80%;float:right;padding:5px;border:1px solid grey;">
<form name="creat">
<div class="mtitle">Creatinine Clearance (CRCL) Calculator</div>
<strong>Creatinine Clearance (CrCl) Calculator</strong>
<br>
<div>
<label for="a" style="width:70px;display:inline-block">Age:</label>

<input autocomplete="off" onkeyup="calc_crcl()" name="a" style="width:80px;display:inline-block">
<div class="mline">
years
<div class="mleft">Age:
</div><div class="mmiddle">
</div>
<div>
<input autocomplete=off class="forminputcontent" onkeyup=creatcheck(1) name=a>
<label for="sex" style="width:70px;display:inline-block">Sex:</label>
</div>
<select name="sex" onchange="calc_crcl()" style="width:80px;display:inline-block">
<div class="mright">
<option value="1" selected>Male</option>
Years
<option value="0.85">Female</option>
</div></div>
</select>

<div class="mline">
</div>
<div class="mleft">Sex:
<div>
<label for="w" style="width:70px;display:inline-block">Weight:</label>
</div>
<input autocomplete="off" onkeyup="calc_crcl()" name="w" style="width:50px;display:inline-block">
<div class="mmiddle">
<select name=sex style="height:28px">
<select name="wsel" onchange="calc_crcl()" style="width:70px;display:inline-block">
<option value=0.73 selected>Male</option>
<option value="1" selected>kg</option>
<option value=0.66>Female</option>
<option value="0.4536">lbs</option>
</select>
</select>
</div>
</div>
</div>
<div>
<label for="c" style="width:70px;display:inline-block">Creatinine:</label>

<input autocomplete=off onkeyup="calc_crcl()" name="c" style="width:50px;display:inline-block">

<select name="csel" onchange="calc_crcl()" style="width:70px;display:inline-block">
<div class="mline">
<option value="88">mg/dL</option>
<div class="mleft">Body Weight:
<option value="1" selected>umol/L</option>
</div><div class="mmiddle">
</select>
<input autocomplete=off class="forminputcontent" onkeyup=creatcheck(2) name=w>
</div>
</div>
<div class="mright">
<div>
<label for="res" style="width:70px;display:inline-block">CrCl:</label>
<select name=wsel>
<input ReadOnly name="res" style="width:50px;display:inline-block;background-color:#cccccc">
<option value=2.2046 >Kilograms</option>
<span style="width:30px;display:inline-block">mL/min</span>
<option value=1 selected>Pounds</option>
</select>
</div>
</div></div>

<div class="mline">
<div class="mleft">Serum Creatinine:
</div><div class="mmiddle">
<input autocomplete=off class="forminputcontent" onkeyup=creatcheck(3) name=c>
</div>
<div class="mright">
<select name=csel>
<option value=1>mg/dL</option>
<option value=0.0113636>umol/L</option>
</select>
</div></div>

<div class="mline">
<div class="mleft">Creatinine Clear Rate:
</div><div class="mmiddle">
<input ReadOnly class="forminputcontent" name=res style="color:red;background-color:#cccccc">
</div>
<div class="mright">
mL/min
</div></div>

<div class="mcalc">
<input onclick="calcreat()" type="button" name="Calculate" value="Calculate"/>
<input onclick="creatclear()" type="button" name="reset" value="Reset All"/>
</div>

</form>
</form>

Latest revision as of 22:14, 15 August 2019

<script type="text/javascript"> function calc_crcl() { var age = document.crcl.a.value; var creat = document.crcl.c.value; var weight = document.crcl.w.value; var creat_units = document.crcl.csel.value; var weight_units = document.crcl.wsel.value; var sex = document.crcl.sex.value;

if (age=="" || weight=="" || creat=="") return;

var crcl = 1.2 * (140 - age) * (weight * weight_units) / (creat * creat_units) * sex;

if (crcl < 10) document.crcl.res.value = "< 10"; else document.crcl.res.value = Math.floor(crcl); } </script> <form name="crcl" style="font-size:80%;float:right;padding:5px;border:1px solid grey;"> Creatinine Clearance (CrCl) Calculator

<label for="a" style="width:70px;display:inline-block">Age:</label> <input autocomplete="off" onkeyup="calc_crcl()" name="a" style="width:80px;display:inline-block"> years

<label for="sex" style="width:70px;display:inline-block">Sex:</label> <select name="sex" onchange="calc_crcl()" style="width:80px;display:inline-block"> <option value="1" selected>Male</option> <option value="0.85">Female</option> </select>

<label for="w" style="width:70px;display:inline-block">Weight:</label> <input autocomplete="off" onkeyup="calc_crcl()" name="w" style="width:50px;display:inline-block"> <select name="wsel" onchange="calc_crcl()" style="width:70px;display:inline-block"> <option value="1" selected>kg</option> <option value="0.4536">lbs</option> </select>

<label for="c" style="width:70px;display:inline-block">Creatinine:</label> <input autocomplete=off onkeyup="calc_crcl()" name="c" style="width:50px;display:inline-block"> <select name="csel" onchange="calc_crcl()" style="width:70px;display:inline-block"> <option value="88">mg/dL</option> <option value="1" selected>umol/L</option> </select>

<label for="res" style="width:70px;display:inline-block">CrCl:</label> <input ReadOnly name="res" style="width:50px;display:inline-block;background-color:#cccccc"> mL/min

</form>