--
You received this message because you are subscribed to the Google Groups "HEO iForms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to heo-iforms+...@googlegroups.com.
To post to this group, send email to heo-i...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/heo-iforms/-/NY4Pe3O4YjQJ.
For more options, visit https://groups.google.com/groups/opt_out.
Thanks much!
myDose = Math.min((weight*10), 500);I would get rid of the document.form.elementname syntax and stick with document.getElementById (or use jquery selectors). I noticed that mgkg doesn’t have an id, weight has a different name than its id, and TotalDose and Totaldose don’t match. They don’t need to, but it can get confusing when they don’t. This works for me, I used document.getElementById and gave an id to mgkg.
If you’re still having problems, post your entire html document and I’ll take a look.
<html>
<head>
<title>Weight Calc</title>
<script language="javascript">
function calculateDOSE()
{
var wtStr = document.getElementById("mgkg").value;
if (!wtStr)
wtStr = '0';
var htStr = document.getElementById("wt").value;
if (!htStr)
htStr = '0';
var weight = parseFloat(wtStr);
var height = parseFloat(htStr);
document.getElementById("Totaldose").value = weight * height + 4;
}
</script>
</head>
<body>
<form>
<input name="" type="checkbox" value="" />iv fluid at 4 ml/hr PLUS <input type="Text" name="mgkg" id="mgkg" size="4"> mg/kg
<input type="Text" name="weight" id="wt" size="4" > Weight
<input name="clac_wt" type="button" value="calculate" onclick="calculateDOSE()"/> = Dose<input type="Text" name="TotalDose" id="Totaldose" size="4"> mg/kg per hr
</form>
</body>
</html>
--
You received this message because you are subscribed to the Google Groups "HEO iForms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to heo-iforms+...@googlegroups.com.
To post to this group, send email to heo-i...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/heo-iforms/-/V7y0szN4_LoJ.