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
Line 1: Line 1:
<script type="text/javascript">
<script type="text/javascript">
function calcreat()
function calcreat() {
var age = document.creat.a.value;
{
var creat = document.creat.c.value;
//alert('good');
var a = document.creat.a.value;
var weight = document.creat.w.value;
var c = document.creat.c.value;
var sex = document.creat.sex.value;

var w = document.creat.w.value;
if (a=="" || w=="" || c=="")
var wsel = document.creat.wsel.value;
return;
var csel = document.creat.csel.value;

var sex = document.creat.sex.value;
var crcl = 1.2 * (140 - age) * weight / creat;
//alert(w);
if (a=="" || w=="" || c=="")
if (sex == "Female") crcl = crcl * 0.85;
if (crcl < 0) crcl = 0;
{return;}
document.creat.res.value = crcl;
else
{
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>

Revision as of 20:40, 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 sex = document.creat.sex.value;

if (a=="" || w=="" || c=="") return;

var crcl = 1.2 * (140 - age) * weight / creat; if (sex == "Female") crcl = crcl * 0.85; if (crcl < 0) crcl = 0; document.creat.res.value = crcl; } </script> <form name="creat">

Creatinine Clearance (CRCL) Calculator


Age:

<input autocomplete=off class="forminputcontent" onkeyup=creatcheck(1) name=a>

Years

Sex:

<select name=sex style="height:28px"> <option value=0.73 selected>Male</option> <option value=0.66>Female</option> </select>


Body Weight:

<input autocomplete=off class="forminputcontent" onkeyup=creatcheck(2) name=w>

<select name=wsel> <option value=2.2046 >Kilograms</option> <option value=1 selected>Pounds</option> </select>

Serum Creatinine:

<input autocomplete=off class="forminputcontent" onkeyup=creatcheck(3) name=c>

<select name=csel> <option value=1>mg/dL</option> <option value=0.0113636>umol/L</option> </select>

Creatinine Clear Rate:

<input ReadOnly class="forminputcontent" name=res style="color:red;background-color:#cccccc">

mL/min

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

</form>