kunne gi et eks:
<HTML>
<HEAD>
<TITLE>Javascript Calculator for Maximum Allowable Blood Loss</TITLE>
<SCRIPT LANGUAGE="JAVASCRIPT">
<!-- hide this script tag's contents from old browsers
function SetForm(form){
form.hba.value="14";
form.hbl.value="10";
form.wt.value = "70";
form.comp.value = "72";
form.ptmabl.value = "";
form.my_comment.value = "Give it a try!!";
}
function ClearForm(form){
form.hba.value="";
form.hbl.value="";
form.wt.value = "";
form.comp.value = "";
form.ptmabl.value = "";
form.my_comment.value = "";
}
function mabl(hba, hbl, wt, comp) {
mablval=((hba-hbl)/hba)*(wt*comp);
return mablval;
}
function checkform(form) {
if (form.hba.value==null||form.hba.value.length==0 || form.hbl.value==null||form.hbl.value.length==0||form.wt.value==null|| form.wt.value.length==0||form.comp.value==null||form.comp.value.length==0){
alert("\nPlease complete the form first");
return false;
}
else if (parseFloat(form.hba.value) < 2||
parseFloat(form.hba.value) >20){
alert("\nHb must be between 2 and 20 g/dl");
return false;
}
else if (parseFloat(form.wt.value) < 3||
parseFloat(form.wt.value) >300){
alert("\nWeight must be between 3 and 300 kgs");
return false;
}
else if (parseFloat(form.hbl.value) < 2||
parseFloat(form.hbl.value) >20){
alert("\nMinimum Hb limit must be between 2 and 20 ");
return false;
}
else if (parseFloat(form.comp.value) < 60||
parseFloat(form.comp.value) >100){
alert("\nComposition value must be between 60 and 100 ");
return false;
}
return true;
}
function computeform(form) {
if (checkform(form)) {
ptmabl=Math.round(mabl(form.hba.value, form.hbl.value, form.wt.value, form.comp.value));
form.ptmabl.value=ptmabl;
if (ptmabl >1000 ) {
form.my_comment.value="Can lose at least a couple of units!";
}
else if (ptmabl >500 && ptmabl <=1000) {
form.my_comment.value="Can lose at least another unit!";
}
else if (ptmabl >0 && ptmabl <=500) {
form.my_comment.value="Get blood ready!";
}
else if (ptmabl <=0) {
form.my_comment.value="Needs blood NOW";
}
}
return;
}
// -- done hiding from old browsers -->
</SCRIPT>
<meta name="Microsoft Theme" content="copy-3-of-blank 011, default">
</HEAD>
<BODY bgcolor=#FFFFFF link=#999999 text=#000000 onLoad="SetForm(document.BMI)" background="" vlink="#990000" alink="#666666"><!--mstheme--><font face="Arial, Arial, Helvetica">
<NOSCRIPT> <CENTER>Sorry - you must have a JavaScript compatible browser for this to work.<BR>
I suggest you download Netscape 3.0, or, if you must, MIE 3.0</CENTER></NOSCRIPT>
<!-- Loosely based on a Body Mass program by Ashley Cheng (ackcheng@ha.org.hk, "
http://www.iohk.com/UserPages/acheng") -->
<CENTER>
<H3>Maximum Allowable Blood Loss Calculator <BR>
How much blood can your patient lose?</H3>
<!--msthemeseparator--><p align="center"><img src="_themes/copy-3-of-blank/ablrule.gif" width="600" height="10"></p>
</CENTER>
Enter patient's weight in kilograms and Hb in g/dl (i.e. about 14).
If you wish, you may change the minimum Hb limit and the volume of blood per kg body mass.
Press the "Let's See!" button to calculate the MABL!
<EM>(Please read disclaimer below before using this form)</EM>
<CENTER><FORM NAME="BMI" method=POST>
<!--mstheme--></font><TABLE border=1 width=100% bordercolordark="#666666" bordercolorlight="#CCCCCC">
<TR>
<TH WIDTH=15%><!--mstheme--><font face="Arial, Arial, Helvetica">Patient's Weight <BR>(kg)<!--mstheme--></font></TH>
<TH WIDTH=15%><!--mstheme--><font face="Arial, Arial, Helvetica">Patient's Hb <BR>(g/dl)<!--mstheme--></font></TH>
<TH WIDTH=35%><!--mstheme--><font face="Arial, Arial, Helvetica">Minimum Hb <BR>(g/dl)<!--mstheme--></font></TH>
<TH WIDTH=35%><!--mstheme--><font face="Arial, Arial, Helvetica">Body Composition <BR> (ml blood per kg)<!--mstheme--></font></TH></TR>
<TR>
<TH><!--mstheme--><font face="Arial, Arial, Helvetica"><INPUT TYPE=TEXT NAME=wt SIZE=10 onFocus="this.form.wt.value=''"><!--mstheme--></font></TH>
<TH><!--mstheme--><font face="Arial, Arial, Helvetica"><INPUT TYPE=TEXT NAME=hba SIZE=10 onFocus="this.form.hba.value=''"><!--mstheme--></font></TH>
<TH><!--mstheme--><font face="Arial, Arial, Helvetica"><INPUT TYPE=TEXT NAME=hbl SIZE=10 onFocus="this.form.hbl.value=''"><!--mstheme--></font></TH>
<TH><!--mstheme--><font face="Arial, Arial, Helvetica"><INPUT TYPE=TEXT NAME=comp SIZE=10 onFocus="this.form.comp.value=''"><!--mstheme--></font></TH></TR>
<TR>
<TH COLSPAN=2><!--mstheme--><font face="Arial, Arial, Helvetica">Patient's MABL<!--mstheme--></font></TH>
<TH COLSPAN=2><!--mstheme--><font face="Arial, Arial, Helvetica">My Comment<!--mstheme--></font></TH>
</TR>
<TR>
<TH COLSPAN=2><!--mstheme--><font face="Arial, Arial, Helvetica">**<INPUT TYPE=TEXT NAME="ptmabl" SIZE=10>**<!--mstheme--></font></TH>
<TH COLSPAN=2><!--mstheme--><font face="Arial, Arial, Helvetica">**<INPUT TYPE=TEXT NAME="my_comment" SIZE=40>**<!--mstheme--></font></TH>
</TR></TABLE><!--mstheme--><font face="Arial, Arial, Helvetica">
<P>
<INPUT TYPE="button" VALUE="Let's See!" onClick="computeform(this.form)">
<INPUT TYPE="button" VALUE="Set to Defaults" onClick="SetForm(this.form)">
<INPUT TYPE="reset" VALUE="Clear All" onClick="ClearForm(this.form)">
</FORM></CENTER>
<!--msthemeseparator--><p align="center"><img src="_themes/copy-3-of-blank/ablrule.gif" width="600" height="10"></p>
<B>Disclaimer</B>:
The formula used is:<BR>MABL=[(Hb-MinimumHb)/Hb]x(Weight in kgs) x (mls of blood per kg body weight).<BR>
This form is only meant to be a demonstration of how Javascript(tm) could be used
on a Web Page. Information it contains may not be accurate and is not designed
or intended to serve as medical advice. I shall not be liable for any damages suffered as a result of using this form or script.<P>
<!--msthemeseparator--><p align="center"><img src="_themes/copy-3-of-blank/ablrule.gif" width="600" height="10"></p>
<CENTER>
<H5>©1997 John Oyston (oyston@oyston.com)<BR>
Loosely based on a Body Mass program by Ashley Cheng<BR> (ackcheng@ha.org.hk, "
http://www.iohk.com/UserPages/acheng")<BR>
You may make one copy of this page for your own personal use.
</H5></CENTER>
<!--mstheme--></font></BODY>
</HTML>