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 |
||
(17 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<includeonly> | <includeonly> | ||
<script type="text/javascript"> | <script type="text/javascript"> | ||
$(document).ready(function(){ | $(document).ready(function () { | ||
$(" | $("#calc").click(function () { | ||
var temp = $(" | //Modify Below | ||
$("output").html(temp); | 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')) { | |||
temp = temp * .85; | |||
console.log(temp); | |||
} | |||
$("#output").html(temp); | |||
if (temp > 50) { | |||
$("#output").append("<br />Regular Dose") | |||
} else if (temp >= 30 || temp <= 50) { | |||
$("#output").append("<br />250-500 mg q12h") | |||
} else if (temp <= 29) { | |||
$("#output").append("<br />250-500 mg q18h") | |||
} | |||
//Don't touch below! | |||
}); | |||
}); | }); | ||
</script> | </script> | ||
<input type="text" id="input1" />< | <table> | ||
< | <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> | ||
<input type="text" id=" | <tr><td>Age: </td><td><input type="text" id="input2" /></td><td></td></tr> | ||
<input type="text" id=" | <tr><td>Serum: </td><td><input type="text" id="input3" /></td><td></td></tr> | ||
<input type=" | <tr><td>Female? </td><td><input type="checkbox" id="input4" /></td><td></td></tr> | ||
<input type=" | <tr><td colspan="2"><input type="button" value="Calc" id="calc" /></td><td></td></tr> | ||
<div id="output"> | </table> | ||
<div id="output"></div> | |||
</includeonly> | </includeonly> |