473,513 Members | 4,116 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Javascript code to sum up totals

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:o="urn:schemas-microsoft-com:office:office"
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:676p x'><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>

Jul 23 '05 #1
3 9110
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).va lue);
}
}
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>

In article <11*********************@l41g2000cwc.googlegroups. com>, ne**********@yahoo.com says...
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:o="urn:schemas-microsoft-com:office:office"
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>

Jul 23 '05 #2
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.

Jul 23 '05 #3
netsurfer wrote:
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.
--
Fred
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
15452
by: YT | last post by:
Hello, Here's the situation: I have several fields split into 2 sections (Debt & Equity) on a form that should only take numerical values. The page is a mix of Javascript & ASP such that when the user visits the page, the initial values of the field are filled in by Session cookies. When the cursor leaves a field, the code checks to see if...
53
5657
by: Cardman | last post by:
Greetings, I am trying to solve a problem that has been inflicting my self created Order Forms for a long time, where the problem is that as I cannot reproduce this error myself, then it is difficult to know what is going on. One of these Order Forms you can see here... http://www.cardman.co.uk/orderform.php3
4
3382
by: New Guy | last post by:
I'm trying to work with a system that somebody else built and I am confounded by the following problem: There is a table of payments and a table of charges. Each client has charges and payments during the month. I'd like to get the totals of the payments and of the charges for each client. When I run the following query, I get huge...
4
2030
by: yanyo | last post by:
hi, im trying to figure out whats the problem with this program i get a runtime error but i dont see where the problem is i tried changing declaration but nothing if somrbody can try this on their compiler to make sure is not a compiler compatibility problem. #include<stdio.h> #include<math.h> char menu_action(void);
2
2693
by: BerkshireGuy | last post by:
I have the following code: Dim strSQL As String Dim DB As DAO.Database Dim RS As DAO.Recordset Dim intNumOfPaid, intNumOfHypoed, intNumOfNotTaken, intNumOfDeclined, intNumOfWasted, intNumOfApproved As String Dim QDF As QueryDef Dim PARAM As Parameter
24
6288
by: firstcustomer | last post by:
Hi, Firstly, I know NOTHING about Javascript I'm afraid, so I'm hoping that someone will be able to point me to a ready-made solution to my problem! A friend of mine (honest!) is wanting to have on his site, a Javascript Calculator for working out the cost of what they want, for example: 1 widget and 2 widglets = £5.00
1
6846
by: kenny8787 | last post by:
Hi, can anyone help here? I have the following code generated from a database, I want to have javascript calculate the costs of the selected items using radio buttons, subtotal the costs and grandtotal the costs ready for the selected items to be inserted back to the database. I did something like this before with Checkboxes, but...
4
59897
by: verci | last post by:
Hi guys, I'm running asp.net 2.0. Does anyone know how to fire or call a javascript function from inside my (VB.aspx) code without assigning it to a control attribute? thank you
5
3938
prn
by: prn | last post by:
Hi folks, I'm looking for a little advice here. I need to create a report that is totals only, with no detail records. I have a database with a lot of individuals (people) and the report has to have some overall totals, totals per state, totals by gender, race/ethnicity, and several other criteria. This report does not need to (and should not)...
0
7270
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7563
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7543
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5703
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5102
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3252
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
1612
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
813
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
470
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.