Javascript code to sum up totals

N

netsurfer

Hi:

I am working on a project and need assistance, and would really
appreciate any feedback on it.

First part I'm banging my head against the wall on is about the amounts
of the Amount fields along the right to automatically equal the PETTY
CASH SUB-TOTAL field. So, the amount in this PETTY CASH SUB-TOTAL
field comes up automatically. Also, I need to have the amount in the
TOTAL AMOUNT field come up automatically as being the sum of the PETTY
CASH SUB-TOTAL and the PER DIEM SUB-TOTAL fields. Please see the
following as an HTML document to see what I'm talking about. Thanks
very much in advanced for any response.

<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:eek:="urn:schemas-microsoft-com:eek:ffice:eek:ffice"
xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<link rel="File-List" href="draft2_files/filelist.xml">
<title>Name</title>
<!--[if !mso]>
<style>
v\:* { behavior: url(#default#VML) }
o\:* { behavior: url(#default#VML) }
..shape { behavior: url(#default#VML) }
</style>
<![endif]--><!--[if gte mso 9]>
<xml><o:shapedefaults v:ext="edit" spidmax="1027"/>
</xml><![endif]-->
</head>

<body>

<table border="1" width="100%" id="table13">
<tr>
<td width="424">Name:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<INPUT TYPE=text NAME="name_57" SIZE="20" MAXLENGTH="100"
VALUE=""></td>
<td width="258">Date:&nbsp;&nbsp;&nbsp;&nbsp;
<INPUT TYPE=text NAME="name_58" SIZE="20" MAXLENGTH="100"
VALUE=""></td>
<td>Job No:&nbsp;&nbsp;&nbsp;
<INPUT TYPE=text NAME="name_59" SIZE="20" MAXLENGTH="100"
VALUE=""></td>
</tr>
</table>























<FORM>
<TABLE id="table14">
<TR VALIGN="top">
<td width="109" align="center">DATE</td>
<td width="121" align="center">CODE</td>
<td width="124" align="center">PAID TO</td>
<td width="120" align="center">DESCRIPTION</td>
<td align="center">AMOUNT</td>
</TR>
<tr>
<TD><INPUT TYPE=text NAME="name_38" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_39" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_40" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_41" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_42" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
</tr>
<tr>
<TD><INPUT TYPE=text NAME="name_43" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_44" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_45" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_46" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_47" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
</tr>
<tr>
<TD><INPUT TYPE=text NAME="name_48" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_49" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_50" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_51" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_52" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
</tr>
<tr>
<TD><INPUT TYPE=text NAME="name_53" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_54" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_55" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_56" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="email_14" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
</tr>
<TR VALIGN="top">
<TD><INPUT TYPE=text NAME="name_8" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_11" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_10" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_28" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_9" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
</TR>
<TR VALIGN="top">
<TD><INPUT TYPE=text NAME="name_6" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_12" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_13" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_29" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_7" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
</TR>
<TR VALIGN="top">
<TD><INPUT TYPE=text NAME="name_4" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_14" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_15" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_30" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_5" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
</TR>
<TR VALIGN="top">
<TD><INPUT TYPE=text NAME="name_1" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_16" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_17" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_31" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="email_1" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
</TR>
<TR ID="recip_2" STYLE="DISPLAY:NONE;" VALIGN="top">
<TD><INPUT TYPE=text NAME="email_13" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="email_12" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="email_11" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_32" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="email_10" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
</TR>
<TR ID="recip_2" STYLE="DISPLAY:NONE;" VALIGN="top">
<TD><INPUT TYPE=text NAME="email_9" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_18" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_19" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_33" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="email_8" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
</TR>
<TR ID="recip_2" STYLE="DISPLAY:NONE;" VALIGN="top">
<TD><INPUT TYPE=text NAME="email_6" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_20" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_21" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_34" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="email_7" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
</TR>
<TR ID="recip_2" STYLE="DISPLAY:NONE;" VALIGN="top">
<TD><INPUT TYPE=text NAME="email_5" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_22" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_23" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_35" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="email_4" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
</TR>
<TR ID="recip_2" STYLE="DISPLAY:NONE;" VALIGN="top">
<TD><INPUT TYPE=text NAME="name_2" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_24" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_25" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_36" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="email_2" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
</TR>
<TR ID="recip_3" STYLE="DISPLAY:NONE;" VALIGN="top">
<TD><INPUT TYPE=text NAME="name_3" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_26" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_27" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="name_37" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
<TD><INPUT TYPE=text NAME="email_3" SIZE="20" MAXLENGTH="100"
VALUE=""></TD>
</TR>
<TR><TD COLSPAN="5" ALIGN="right" CLASS="mainbodytext">
<DIV ALIGN="CENTER">Additional Rows:
<SELECT NAME="recip_numb" ONCHANGE="reveal(this);">
<OPTION VALUE="1" SELECTED> 0</OPTION>
<OPTION VALUE="2"> 1</OPTION>
<OPTION VALUE="3"> 2</OPTION>
<!--OPTION VALUE="4"> 4</OPTION>
<OPTION VALUE="5"> 5</OPTION-->
</SELECT>
</DIV>
</TD>
</TR>
</TABLE>
</FORM>
<SCRIPT LANGUAGE="JavaScript" type="text/javascript">
function reveal(s) {
var val = s.options[s.selectedIndex].value;
if (val > 1) {
for (var i = 2; i <= val; i++) {
if (document.getElementById) {
document.getElementById('recip_' + i).style.display = '';
} else if (document.all) {
document.all['recip_' + i].style.display = '';
}
}
} else {
for (var i = s.options.length; i > 1; i--) {
if (document.getElementById) {
document.getElementById('recip_' + i).style.display = 'none';
} else if (document.all) {
document.all['recip_' + i].style.display = 'none';
}
}
}

}


</SCRIPT> <tr>
<td width="103">&nbsp;</td>
<td width="119">&nbsp;</td>
<td width="123">&nbsp;</td>
<td width="117">&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>&nbsp;</DIV>
<table x:str border=0 cellpadding=0 cellspacing=0
style='border-collapse:
collapse;table-layout:fixed;width:741px' id="table15">
<tr height=25 style='mso-height-source:userset;height:18.95pt'>
<td colspan=3 style='border:medium none; padding:0px;
height:19px;mso-ignore:colspan; color:windowtext; font-size:10.0pt;
font-weight:400; font-style:normal; text-decoration:none;
font-family:Arial; text-align:general; vertical-align:bottom;
white-space:nowrap'></td>
<td style="font-weight: 700; font-family: Arial, sans-serif;
text-align: center; color: windowtext; font-size: 10.0pt; font-style:
normal; text-decoration: none; vertical-align: bottom; white-space:
nowrap; border-left: .5pt solid windowtext; border-right: 1.0pt solid
windowtext; border-top: .5pt solid windowtext; border-bottom: medium
none; padding: 0px" width="247" height="19">PETTY CASH SUB-TOTAL</td>
<td style='border-right:1.0pt solid windowtext; border-top:1.0pt
solid windowtext; border-bottom:medium none; padding:0px;
border-left:medium none; font-size:12.0pt; font-weight:700;
font-style:italic; font-family:Arial, sans-serif; text-align:left;
color:windowtext; text-decoration:none; vertical-align:bottom;
white-space:nowrap' x:str="$" width="256" height="19"><span
style='mso-spacerun:yes'> </span>$<span
style='mso-spacerun:yes'> </span></td>
</tr>
<tr height=25 style='mso-height-source:userset;height:18.95pt'>
<td colspan=5 style='border-left:medium none; border-right:medium
none; border-top:.5pt solid windowtext; border-bottom:.5pt solid
windowtext; padding:0px; background:silver; height:31px;
color:windowtext; font-size:10.0pt; font-weight:400; font-style:normal;
text-decoration:none; font-family:Arial; text-align:general;
vertical-align:bottom; white-space:nowrap'>&nbsp;</td>
</tr>
<tr class=xl28 height=25
style='mso-height-source:userset;height:18.95pt'>
<td colspan=5 height=25 style='border-left:medium none;
border-top:medium none; border-bottom:medium none; padding:0px;
border-right:.5pt solid black; height:18.95pt;width:740px;
color:windowtext; font-size:10.0pt; font-weight:400; font-style:normal;
text-decoration:none; font-family:Arial; text-align:general;
vertical-align:bottom; white-space:nowrap' align=left
valign=top><!--[if gte vml 1]><v:line id="_x0000_s1025"

style='position:absolute;left:0;text-align:left;top:0;flip:x;z-index:1'
from="562.5pt,456.75pt" to="562.5pt,962.25pt" strokecolor="windowText"
o:insetmode="auto"/><![endif]--><![if !vml]><span
style='mso-ignore:vglayout;
position:absolute;z-index:1;left:749px;top:608px;width:2px;height:676px'><img
width=2 height=676 src="draft23_files/image001.gif"
v:shapes="_x0000_s1025"></span><![endif]><span
style='mso-ignore:vglayout2'><table cellpadding=0 cellspacing=0
id="table16" width="741" height="64">
<tr>
<td style='border-left:.5pt solid windowtext; border-top:medium
none; border-bottom:1.0pt solid windowtext; padding:0px;
border-right:.5pt solid black; height:64px;width:739px;
font-size:14.0pt; font-weight:700; font-family:Arial, sans-serif;
text-align:center; white-space:normal; color:windowtext;
font-style:normal; text-decoration:none; vertical-align:bottom'>PER
DIEM<p>&nbsp;</td>
</tr>
</table>
</span></td>
</tr>
<tr height=25 style='mso-height-source:userset;height:18.95pt'>
<td rowspan=4 height=100 style='border:medium none; padding:0px;
background:silver; height:75.8pt;color:windowtext; font-size:10.0pt;
font-weight:400; font-style:normal; text-decoration:none;
font-family:Arial; text-align:general; vertical-align:bottom;
white-space:nowrap' width="80">&nbsp;</td>
<td style='border-left:.5pt solid windowtext; border-right:1.0pt
solid windowtext; border-top:medium none; border-bottom:.5pt solid
windowtext; padding:0px; width:80px; font-weight:700;
font-style:italic; font-family:Arial, sans-serif; text-align:center;
white-space:normal; color:windowtext; font-size:10.0pt;
text-decoration:none; vertical-align:bottom'>DATE</td>
<td align=left valign=top style="color: windowtext; font-size:
10.0pt; font-weight: 400; font-style: normal; text-decoration: none;
font-family: Arial; text-align: general; vertical-align: bottom;
white-space: nowrap; border: medium none; padding: 0px" width="325"
colspan="2" rowspan="4">
<table border="1" width="100%" id="table17" cellspacing="0"
cellpadding="0" bordercolorlight="#000000" height="120">
<tr>
<td width="42" align="center" height="30">&nbsp;</td>
<td width="43" align="center" height="30"><b>&nbsp; </b></td>
<td width="44" align="center" height="30">&nbsp;</td>
<td width="44" align="center" height="30">&nbsp;</td>
<td width="45" align="center" height="30">&nbsp;</td>
<td width="40" align="center" height="30">&nbsp;</td>
<td align="center" height="30">&nbsp;</td>
</tr>
<tr>
<td width="42" height="30" align="center"><b><font
size="2">THUR.</font></b></td>
<td height="30" width="43" align="center"><b><font
size="2">FRI.</font></b></td>
<td height="30" width="44" align="center"><b><font
size="2">SAT.</font></b></td>
<td height="30" width="44" align="center"><b><font
size="2">SUN.</font></b></td>
<td height="30" width="45" align="center"><b><font
size="2">MON.</font></b></td>
<td height="30" width="40" align="center"><b><font
size="2">TUES.</font></b></td>
<td height="30" align="center"><b><font
size="2">WED.</font></b></td>
</tr>
<tr>
<td width="42" height="30">&nbsp;</td>
<td height="30" width="43">&nbsp;</td>
<td height="30" width="44">&nbsp;</td>
<td height="30" width="44">&nbsp;</td>
<td height="30" width="45">&nbsp;</td>
<td height="30" width="40">&nbsp;</td>
<td height="30">&nbsp;</td>
</tr>
<tr>
<td width="42" height="28">&nbsp;</td>
<td height="28" width="43">&nbsp;</td>
<td height="28" width="44">&nbsp;</td>
<td height="28" width="44">&nbsp;</td>
<td height="28" width="45">&nbsp;</td>
<td height="28" width="40">&nbsp;</td>
<td height="28">&nbsp;</td>
</tr>
</table>
</td>
<td rowspan=4 style='border:medium none; padding:0px;
background:silver; color:windowtext; font-size:10.0pt; font-weight:400;
font-style:normal; text-decoration:none; font-family:Arial;
text-align:general; vertical-align:bottom; white-space:nowrap'
width="256">&nbsp;</td>
</tr>
<tr height=25 style='mso-height-source:userset;height:18.95pt'>
<td height=25 style='border-left:.5pt solid windowtext;
border-right:1.0pt solid windowtext; border-top:medium none;
border-bottom:.5pt solid windowtext; padding:0px;
height:18.95pt;width:80px; font-weight:700; font-style:italic;
font-family:Arial, sans-serif; text-align:center; white-space:normal;
color:windowtext; font-size:10.0pt; text-decoration:none;
vertical-align:bottom'>DAY</td>
</tr>
<tr height=25 style='mso-height-source:userset;height:18.95pt'>
<td height=25 style='border-left:.5pt solid windowtext;
border-right:1.0pt solid windowtext; border-bottom:.5pt solid
windowtext; padding:0px; height:18.95pt;border-top:medium none; ;
font-weight:700; font-style:italic; font-family:Arial, sans-serif;
text-align:center; color:windowtext; font-size:10.0pt;
text-decoration:none; vertical-align:bottom; white-space:nowrap'
width="80">ROOM</td>
</tr>
<tr height=25 style='mso-height-source:userset;height:18.95pt'>
<td height=25 style='border-left:.5pt solid windowtext;
border-right:1.0pt solid windowtext; border-top:medium none;
border-bottom:1.0pt solid windowtext; padding:0px; height:18.95pt;
font-weight:700; font-style:italic; font-family:Arial, sans-serif;
text-align:center; color:windowtext; font-size:10.0pt;
text-decoration:none; vertical-align:bottom; white-space:nowrap'
width="80">BOARD</td>
</tr>
<tr height=25 style='mso-height-source:userset;height:18.95pt'>
<td colspan=3 rowspan=4 height=107 style='border-left:medium none;
border-top:1.0pt solid windowtext; border-bottom:medium none;
padding:0px; background:silver; border-right:.5pt solid black;
height:80.85pt; color:windowtext; font-size:10.0pt; font-weight:400;
font-style:normal; text-decoration:none; font-family:Arial;
text-align:general; vertical-align:bottom;
white-space:nowrap'>&nbsp;</td>
<td colspan=2 style='border-top:medium none; border-bottom:1.0pt
solid windowtext; padding:0px; background:silver; border-right:1.0pt
solid black; border-left:medium none; color:windowtext;
font-size:10.0pt; font-weight:400; font-style:normal;
text-decoration:none; font-family:Arial; text-align:general;
vertical-align:bottom; white-space:nowrap'>&nbsp;</td>
</tr>
<tr height=25 style='mso-height-source:userset;height:18.95pt'>
<td height=25 style='border-left:medium none; border-right:medium
none; border-top:medium none; border-bottom:1.0pt solid windowtext;
padding:0px; height:18.95pt; font-size:12.0pt; font-weight:700;
font-family:Arial, sans-serif; text-align:center; color:windowtext;
font-style:normal; text-decoration:none; vertical-align:bottom;
white-space:nowrap' width="245">PER DIEM SUB-TOTAL</td>
<td style='border-left:1.0pt solid windowtext; border-right:1.0pt
solid windowtext; border-bottom:1.0pt solid windowtext; padding:0px;
border-top:medium none; font-size:12.0pt; font-weight:700;
font-style:italic; font-family:Arial, sans-serif; text-align:left;
color:windowtext; text-decoration:none; vertical-align:bottom;
white-space:nowrap' x:str="$" width="257"><span
style='mso-spacerun:yes'> </span>$<span
style='mso-spacerun:yes'> </span></td>
</tr>
<tr height=25 style='mso-height-source:userset;height:18.95pt'>
<td colspan=2 height=25 style='border-top:medium none;
border-bottom:1.0pt solid windowtext; padding:0px; background:silver;
border-right:1.0pt solid black; height:18.95pt;border-left:medium none;
; color:windowtext; font-size:10.0pt; font-weight:400;
font-style:normal; text-decoration:none; font-family:Arial;
text-align:general; vertical-align:bottom;
white-space:nowrap'>&nbsp;</td>
</tr>
<tr height=32 style='mso-height-source:userset;height:24.0pt'>
<td height=32 style='border:medium none; padding:0px; height:24.0pt;
font-size:12.0pt; font-weight:700; font-style:italic;
font-family:Arial, sans-serif; text-align:center; color:windowtext;
text-decoration:none; vertical-align:bottom; white-space:nowrap'
width="245">TOTAL AMOUNT</td>
<td style='border-left:1.0pt solid windowtext; border-right:1.0pt
solid windowtext; border-bottom:medium none; padding:0px;
border-top:medium none; font-size:12.0pt; font-weight:700;
font-style:italic; font-family:Arial, sans-serif; text-align:left;
color:windowtext; text-decoration:none; vertical-align:bottom;
white-space:nowrap' x:str="$" width="257"><span
style='mso-spacerun:yes'> </span>$<span
style='mso-spacerun:yes'> </span></td>
</tr>
<tr height=25 style='mso-height-source:userset;height:18.95pt'>
<td colspan=5 height=25 style='border-left:1.0pt solid windowtext;
border-top:1.0pt solid windowtext; border-bottom:1.0pt solid
windowtext; padding:0px; background:silver; border-right:1.0pt solid
black; height:18.95pt; font-weight:700; font-style:italic;
font-family:Arial, sans-serif; text-align:center; color:windowtext;
font-size:10.0pt; text-decoration:none; vertical-align:bottom;
white-space:nowrap'>&nbsp;</td>
</tr>
</table>

<p><!--[if gte vml 1]><v:line
id="_x0000_s1026"
style='position:absolute;left:0;text-align:left;top:0;
z-index:1' from="8.25pt,513pt" to="127.5pt,513pt"
strokecolor="windowText"
o:insetmode="auto"/><![endif]--><![if !vml]><span
style='mso-ignore:vglayout;
position:absolute;z-index:1;left:10px;top:683px;width:161px;height:2px'><img
width=161 height=2 src="draft23_files/image002.gif"
v:shapes="_x0000_s1026"></span><![endif]></p>
<p>&nbsp;</p>

</body>

</html>
 
J

John Doe

Get rid of all the microshaft code and ask again.

A generic answer that doesn't require looking at that eyesore
that you erroniously call an HTML document (If you can't apply
this solution to your problem, don't ask for more help 'til you
clean up your code):

<script type="text/javascript">
function totalfields(f1,f2,total) {
var totfld=document.getElementById(total);
var totval=0;
if ( typeof(f2) == "number" ) {
for(i=1;i<=f2;i++) {
el = document.getElementById(f1+i)
if (! isNaN(parseFloat(el.value))) {
totval += parseFloat(el.value);
}
}
totfld.value=totval;
} else {
if ( isNaN(parseFloat(document.getElementById(f1).value)) || isNaN(parseFloat(document.getElementById(f2).value)) ) {
} else {
totfld.value=parseFloat(document.getElementById(f1).value)+parseFloat(document.getElementById(f2).value);
}
}
totfld.onchange();
}
</script>
<INPUT TYPE=text ID=Amount1 Name=Amount1 Value="" onchange="totalfields('Amount',2,'PettyCashSub');">
<INPUT TYPE=text ID=Amount2 Name=Amount2 Value="" onchange="totalfields('Amount',2,'PettyCashSub');">
<INPUT TYPE=text ID=PettyCashSub Name=PettyCash Value="" DISABLED READONLY onchange="totalfields('PettyCashSub','PerDiumSub','Total');"><br>
<INPUT TYPE=text ID=PerDium1 Name=PerDium1 Value="" onchange="totalfields('PerDium',3,'PerDiumSub');">
<INPUT TYPE=text ID=PerDium2 Name=PerDium2 Value="" onchange="totalfields('PerDium',3,'PerDiumSub');">
<INPUT TYPE=text ID=PerDium3 Name=PerDium3 Value="" onchange="totalfields('PerDium',3,'PerDiumSub');">
<INPUT TYPE=text ID=PerDiumSub Name=PerDiumSub Value="" DISABLED READONLY onchange="totalfields('PettyCashSub','PerDiumSub','Total');"><br>
<INPUT TYPE=text ID=Total Name=Total Value="" DISABLED READONLY> <br>

Hi:

I am working on a project and need assistance, and would really
appreciate any feedback on it.

First part I'm banging my head against the wall on is about the amounts
of the Amount fields along the right to automatically equal the PETTY
CASH SUB-TOTAL field. So, the amount in this PETTY CASH SUB-TOTAL
field comes up automatically. Also, I need to have the amount in the
TOTAL AMOUNT field come up automatically as being the sum of the PETTY
CASH SUB-TOTAL and the PER DIEM SUB-TOTAL fields. Please see the
following as an HTML document to see what I'm talking about. Thanks
very much in advanced for any response.

<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:eek:="urn:schemas-microsoft-com:eek:ffice:eek:ffice"
xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<link rel="File-List" href="draft2_files/filelist.xml">
<title>Name</title>
<!--[if !mso]>
<style>
v\:* { behavior: url(#default#VML) }
o\:* { behavior: url(#default#VML) }
.shape { behavior: url(#default#VML) }
</style>
<![endif]--><!--[if gte mso 9]>
<xml><o:shapedefaults v:ext="edit" spidmax="1027"/>
</xml><![endif]-->
</head>

<body>

<table border="1" width="100%" id="table13">
<tr>
<td width="424">Name:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<INPUT TYPE=text NAME="name_57" SIZE="20" MAXLENGTH="100"
VALUE=""></td>
<td width="258">Date:&nbsp;&nbsp;&nbsp;&nbsp;
<INPUT TYPE=text NAME="name_58" SIZE="20" MAXLENGTH="100"
VALUE=""></td>
<td>Job No:&nbsp;&nbsp;&nbsp;
<INPUT TYPE=text NAME="name_59" SIZE="20" MAXLENGTH="100"
VALUE=""></td>
</tr>
</table>
 
N

netsurfer

ok let's use the generic answer...and thanks for responding...it works
but
it keeps saying
"Object doesn't support this property or method" on the line that says
and in the script debugger I have it points to the line:

totfld.onchange( );

Otherwise it works.
 
F

Fred Oz

netsurfer said:
ok let's use the generic answer...and thanks for responding...it works
but
it keeps saying
"Object doesn't support this property or method" on the line that says
and in the script debugger I have it points to the line:

totfld.onchange( );

Otherwise it works.

The error in this line:

var totfld=document.getElementById(total);

is because "total" is supposed to match the element id in the
input below.

<INPUT TYPE=text ID=Total Name=Total Value="" DISABLED READONLY>

So either make the element id="total" or change the line to be

...getElementById('Total');

Incidentally, quote all attributes and there is no need to make
an input disabled *and* readonly. A readonly input can't be
modified by the user, so there's not much point in also
disabling it.

If your intention is to prevent the field from being submitted
with the form, then don't use a text input as an output field,
use an element that can contain a text node, such as <span>,
<div> or <p>.

Also, there is no point in giving a form element both a name and
an id. Using just a name is all that is required, then you can
access it through the forms collection rather than
getElementById.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,059
Latest member
cryptoseoagencies

Latest Threads

Top