473,734 Members | 2,788 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:sc hemas-microsoft-com:vml"
xmlns:o="urn:sc hemas-microsoft-com:office:offi ce"
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_fi les/filelist.xml">
<title>Name</title>
<!--[if !mso]>
<style>
v\:* { behavior: url(#default#VM L) }
o\:* { behavior: url(#default#VM L) }
..shape { behavior: url(#default#VM L) }
</style>
<![endif]--><!--[if gte mso 9]>
<xml><o:shapede faults v:ext="edit" spidmax="1027"/>
</xml><![endif]-->
</head>

<body>

<table border="1" width="100%" id="table13">
<tr>
<td width="424">Nam e:&nbsp;&nbsp;& nbsp;&nbsp;&nbs p;
<INPUT TYPE=text NAME="name_57" SIZE="20" MAXLENGTH="100"
VALUE=""></td>
<td width="258">Dat e:&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="mainbody text">
<DIV ALIGN="CENTER"> Additional Rows:
<SELECT NAME="recip_num b" ONCHANGE="revea l(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="JavaS cript" 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.getEl ementById) {
document.getEle mentById('recip _' + i).style.displa y = '';
} else if (document.all) {
document.all['recip_' + i].style.display = '';
}
}
} else {
for (var i = s.options.lengt h; i > 1; i--) {
if (document.getEl ementById) {
document.getEle mentById('recip _' + i).style.displa y = 'none';
} else if (document.all) {
document.all['recip_' + i].style.display = 'none';
}
}
}

}
</SCRIPT> <tr>
<td width="103">&nb sp;</td>
<td width="119">&nb sp;</td>
<td width="123">&nb sp;</td>
<td width="117">&nb sp;</td>
<td>&nbsp;</td>
</tr>
</table>&nbsp;</DIV>
<table x:str border=0 cellpadding=0 cellspacing=0
style='border-collapse:
collapse;table-layout:fixed;wi dth:741px' id="table15">
<tr height=25 style='mso-height-source:userset; height:18.95pt' >
<td colspan=3 style='border:m edium none; padding:0px;
height:19px;mso-ignore:colspan; color:windowtex t; 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">PET TY 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:windowtex t; text-decoration:none ; vertical-align:bottom;
white-space:nowrap' x:str="$" width="256" height="19"><sp an
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:silv er; height:31px;
color:windowtex t; 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:windowtex t; 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_s102 5"

style='position :absolute;left: 0;text-align:left;top: 0;flip:x;z-index:1'
from="562.5pt,4 56.75pt" to="562.5pt,962 .25pt" strokecolor="wi ndowText"
o:insetmode="au to"/><![endif]--><![if !vml]><span
style='mso-ignore:vglayout ;
position:absolu te;z-index:1;left:74 9px;top:608px;w idth:2px;height :676px'><img
width=2 height=676 src="draft23_fi les/image001.gif"
v:shapes="_x000 0_s1025"></span><![endif]><span
style='mso-ignore:vglayout 2'><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;wid th:739px;
font-size:14.0pt; font-weight:700; font-family:Arial, sans-serif;
text-align:center; white-space:normal; color:windowtex t;
font-style:normal; text-decoration:none ; vertical-align:bottom'>P ER
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:m edium none; padding:0px;
background:silv er; height:75.8pt;c olor: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">&nbs p;</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:windowtex t; font-size:10.0pt;
text-decoration:none ; vertical-align:bottom'>D ATE</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" bordercolorligh t="#000000" height="120">
<tr>
<td width="42" align="center" height="30">&nb sp;</td>
<td width="43" align="center" height="30"><b> &nbsp; </b></td>
<td width="44" align="center" height="30">&nb sp;</td>
<td width="44" align="center" height="30">&nb sp;</td>
<td width="45" align="center" height="30">&nb sp;</td>
<td width="40" align="center" height="30">&nb sp;</td>
<td align="center" height="30">&nb sp;</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">&nb sp;</td>
<td height="30" width="43">&nbs p;</td>
<td height="30" width="44">&nbs p;</td>
<td height="30" width="44">&nbs p;</td>
<td height="30" width="45">&nbs p;</td>
<td height="30" width="40">&nbs p;</td>
<td height="30">&nb sp;</td>
</tr>
<tr>
<td width="42" height="28">&nb sp;</td>
<td height="28" width="43">&nbs p;</td>
<td height="28" width="44">&nbs p;</td>
<td height="28" width="44">&nbs p;</td>
<td height="28" width="45">&nbs p;</td>
<td height="28" width="40">&nbs p;</td>
<td height="28">&nb sp;</td>
</tr>
</table>
</td>
<td rowspan=4 style='border:m edium none; padding:0px;
background:silv er; color:windowtex t; 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">&nb sp;</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:windowtex t; font-size:10.0pt; text-decoration:none ;
vertical-align:bottom'>D AY</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:windowtex t; 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:windowtex t; font-size:10.0pt;
text-decoration:none ; vertical-align:bottom; white-space:nowrap'
width="80">BOAR D</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:silv er; border-right:.5pt solid black;
height:80.85pt; color:windowtex t; 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:silv er; border-right:1.0pt
solid black; border-left:medium none; color:windowtex t;
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:windowtex t;
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:windowtex t; text-decoration:none ; vertical-align:bottom;
white-space:nowrap' x:str="$" width="257"><sp an
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:silv er;
border-right:1.0pt solid black; height:18.95pt; border-left:medium none;
; color:windowtex t; 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:m edium 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:windowtex t;
text-decoration:none ; vertical-align:bottom; white-space:nowrap'
width="245">TOT AL 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:windowtex t; text-decoration:none ; vertical-align:bottom;
white-space:nowrap' x:str="$" width="257"><sp an
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:silv er; border-right:1.0pt solid
black; height:18.95pt; font-weight:700; font-style:italic;
font-family:Arial, sans-serif; text-align:center; color:windowtex t;
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_s102 6"
style='position :absolute;left: 0;text-align:left;top: 0;
z-index:1' from="8.25pt,51 3pt" to="127.5pt,513 pt"
strokecolor="wi ndowText"
o:insetmode="au to"/><![endif]--><![if !vml]><span
style='mso-ignore:vglayout ;
position:absolu te;z-index:1;left:10 px;top:683px;wi dth:161px;heigh t:2px'><img
width=161 height=2 src="draft23_fi les/image002.gif"
v:shapes="_x000 0_s1026"></span><![endif]></p>
<p>&nbsp;</p>

</body>

</html>

Jul 23 '05 #1
3 9124
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.getEle mentById(f1+i)
if (! isNaN(parseFloa t(el.value))) {
totval += parseFloat(el.v alue);
}
}
totfld.value=to tval;
} else {
if ( isNaN(parseFloa t(document.getE lementById(f1). value)) || isNaN(parseFloa t(document.getE lementById(f2). value)) ) {
} else {
totfld.value=pa rseFloat(docume nt.getElementBy Id(f1).value)+p arseFloat(docum ent.getElementB yId(f2).value);
}
}
totfld.onchange ();
}
</script>
<INPUT TYPE=text ID=Amount1 Name=Amount1 Value="" onchange="total fields('Amount' ,2,'PettyCashSu b');">
<INPUT TYPE=text ID=Amount2 Name=Amount2 Value="" onchange="total fields('Amount' ,2,'PettyCashSu b');">
<INPUT TYPE=text ID=PettyCashSub Name=PettyCash Value="" DISABLED READONLY onchange="total fields('PettyCa shSub','PerDium Sub','Total');" ><br>
<INPUT TYPE=text ID=PerDium1 Name=PerDium1 Value="" onchange="total fields('PerDium ',3,'PerDiumSub ');">
<INPUT TYPE=text ID=PerDium2 Name=PerDium2 Value="" onchange="total fields('PerDium ',3,'PerDiumSub ');">
<INPUT TYPE=text ID=PerDium3 Name=PerDium3 Value="" onchange="total fields('PerDium ',3,'PerDiumSub ');">
<INPUT TYPE=text ID=PerDiumSub Name=PerDiumSub Value="" DISABLED READONLY onchange="total fields('PettyCa shSub','PerDium Sub','Total');" ><br>
<INPUT TYPE=text ID=Total Name=Total Value="" DISABLED READONLY> <br>

In article <11************ *********@l41g2 000cwc.googlegr oups.com>, ne**********@ya hoo.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:sc hemas-microsoft-com:vml"
xmlns:o="urn:sc hemas-microsoft-com:office:offi ce"
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_fi les/filelist.xml">
<title>Name</title>
<!--[if !mso]>
<style>
v\:* { behavior: url(#default#VM L) }
o\:* { behavior: url(#default#VM L) }
.shape { behavior: url(#default#VM L) }
</style>
<![endif]--><!--[if gte mso 9]>
<xml><o:shapede faults v:ext="edit" spidmax="1027"/>
</xml><![endif]-->
</head>

<body>

<table border="1" width="100%" id="table13">
<tr>
<td width="424">Nam e:&nbsp;&nbsp;& nbsp;&nbsp;&nbs p;
<INPUT TYPE=text NAME="name_57" SIZE="20" MAXLENGTH="100"
VALUE=""></td>
<td width="258">Dat e:&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

...getElementBy Id('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
15465
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 the entry is a number, and if it is not then it replaces it with a "0". Then it checks each field for...
53
5737
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
3398
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 numbers that appear as if the join is not working correctly.
4
2046
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
2703
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
6337
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
6891
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 Radio button have to be named the same to maintain their groupings.
4
59907
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
3946
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) report on each individual, just the totals. I can create expressions for each of the items I...
0
9310
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9236
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9182
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6735
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6031
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4550
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4809
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2724
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2180
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.