Widget:RimCalc: Difference between revisions
Jump to navigation
Jump to search
Matt Pijoan (talk | contribs) No edit summary |
Matt Pijoan (talk | contribs) No edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
$(document).ready(function () { | $(document).ready(function () { | ||
$("#calc").click(function () { | $("#calc").click(function () { | ||
//Modify Below | //Modify Below | ||
var temp = 0; | var temp = 0; | ||
var weight = 0; | |||
var age = 0; | |||
var serum = 0; | |||
if ($("#wtype").val() === "Pounds") { | |||
weight = parseInt($("#input1").val()) * .45; | |||
} else { | |||
weight = parseInt($("#input1").val()); | |||
} | |||
age = parseInt($("#input2").val()); | |||
serum = parseFloat($("#input3").val()); | |||
temp = (140 - age) * weight; | |||
temp = temp / (serum * 72); | |||
if ($("#input4").is(':checked')) { | if ($("#input4").is(':checked')) { | ||
temp = temp * .85; | temp = temp * .85; | ||
Line 15: | Line 23: | ||
$("#output").html(temp); | $("#output").html(temp); | ||
if (temp > 50) { | |||
$("#output").append("<br />Regular Dose") | |||
} else if (temp >= 30 || temp <= 50) { | |||
//Don't touch! | $("#output").append("<br />250-500 mg q12h") | ||
} else if (temp <= 29) { | |||
$("#output").append("<br />250-500 mg q18h") | |||
} | |||
//Don't touch below! | |||
}); | }); | ||
}); | }); | ||
Line 24: | Line 36: | ||
</script> | </script> | ||
<table> | <table> | ||
<tr><td>Weight (kg):</td><td> <input type="text" id="input1" /></td></tr> | <tr><td>Weight (kg):</td><td> <input type="text" id="input1" /></td><td><select id="wtype"><option value="Kilograms">Kilograms</option><option value="Pounds">Pounds</option></select></td></tr> | ||
<tr><td>Age: </td><td><input type="text" id="input2" /></td></tr> | <tr><td>Age: </td><td><input type="text" id="input2" /></td><td></td></tr> | ||
<tr><td>Serum: </td><td><input type="text" id="input3" /></td></tr> | <tr><td>Serum: </td><td><input type="text" id="input3" /></td><td></td></tr> | ||
<tr><td>Female? </td><td><input type="checkbox" id="input4" /></td></tr> | <tr><td>Female? </td><td><input type="checkbox" id="input4" /></td><td></td></tr> | ||
<tr><td colspan="2"><input type="button" value="Calc" id="calc" /></td></tr> | <tr><td colspan="2"><input type="button" value="Calc" id="calc" /></td><td></td></tr> | ||
</table> | </table> | ||
<div id="output"></div> | <div id="output"></div> | ||
</includeonly> | </includeonly> |