Solved

Order Form totals

Posted on 2004-04-30
1
196 Views
Last Modified: 2010-04-25
I have written this code (its an order form)but I cant get it to calculate the totals. Can anybody please help.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
</head>
<script language="JavaScript">
<!--
 function CalculateTotals() {
 f=document.toylist;
 f.total=value=parseInt(f.qty1.value)*9.99;
 f.total=value=parseInt(f.qty2.value)*3.99;
 f.total=value=parseInt(f.qty3.value)*11.99;
 f.total=value=parseInt(f.qty1.value)*1.99;
 f.grandtotal.value=parseInt(f.total1.value)
 +parseInt(f.total2.value)
 +parseInt(f.total3.value)
 +parseInt(f.total4.value);}//-->
 </script>
<body background="cldsbkg.gif">
<div id="Layer1" style="position:absolute; left:168px; top:128px; width:526px; height:68px; z-index:1">
  <p><font color="#8000FF" size="3"><strong>Here is a list of products that we
    currently supply:</strong></font><br />
  <strong><font color="#8000FF" size="2">(Please enter the quantity required
    &amp click submit when finished)</font></strong></p>
</div>


<div id="Layer2" style="position:absolute; left:152px; top:213px; width:576px; height:91px; z-index:2">
<form name="toylist" method="post">
    <table border="1">
      <tr>
        <th>Product</th>
        <th>Qty Available</th>
        <th>Price</th>
        <th>Qty Required</th>
        <th>Total</th>
      </tr>
      <tr>
        <td>Train Set</td>
        <td><div align="center">15</div></td>
        <td><div align="right">£9.99</div></td>
        <td><div align="right"><input name="qty1" size="15" onBlur="CalculateTotals()" /></div></td>
            <td><div align="right"><input name="total1" size="7"
                 onFocus="document.toylist.qty2.select();
                            document.toylist.qty2.focus();" /></div></td>
      </tr>
        <tr>
        <td>Teddy Bear</td>
        <td><div align="center">30</div></td>
        <td><div align="right">£3.99</div></td>
        <td><div align="right"><input name="qty2" size="15" onBlur="CalculateTotals()" /></div></td>
            <td><div align="right"><input name="total1" size="7"
                 onFocus="document.toylist.qty3.select();
                            document.toylist.qty3.focus();" /></div></td>
      </tr>
        <tr>
        <td>Junior Monopoly</td>
        <td><div align="center">5</div></td>
        <td><div align="right">£11.99</div></td>
        <td><div align="right"><input name="qty3" size="15" onBlur="CalculateTotals()" /></div></td>
            <td><div align="right"><input name="total1" size="7"
                 onFocus="document.toylist.qty4.select();
                            document.toylist.qty4.focus();" /></div></td>
      </tr>
        <tr>
        <td>Barbie Doll</td>
        <td><div align="center">50</div></td>
        <td><div align="right">£1.99</div></td>
        <td><div align="right"><input name="qty4" size="15" onBlur="CalculateTotals()" /></div></td>
            <td><div align="right"><input name="total1" size="7"
                 onFocus="document.toylist.qty1.select();
                            document.toylist.qty1.focus();" /></div></td>
      </tr>
        <tr><td></td><td></td><td></td><td>Grand Total</td><td><input name="grandtotal" size="7"
        onfocus="document.toylist.qty1.select();
        document.toylist.qty1.focus();" /></td></tr>
    </table>
      <br /><input type="submit" value="Submit" />
      
</form>

</div>
<table width="69%" border="1" align="center">
  <tr>
    <td><div align="center"><font color="#8000FF" size="7">ICA TOYS</font></div></td>
  </tr>
</table>
<p>&nbsp;</p>
<table width="16%" border="1" font color="#8000FF">
  <tr>
    <td><strong><font color="#8000FF" size="2">LOGIN</a></font></strong></td>
  </tr>
  <tr>
    <td><strong><font color="#8000FF" size="2"></a>NEW CUSTOMER</font></strong></td>
  </tr>
  <tr>
    <td><div align="left"><strong><font color="#8000FF" size="2"></a>TOY LIST</font></strong></div></td>
  </tr>
</table>

<p>&nbsp;</p>
</body>
</html>
0
Comment
Question by:studly1_uk
1 Comment
 
LVL 4

Accepted Solution

by:
indigostark earned 50 total points
ID: 10959575
Here you go

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
</head>
<script language="JavaScript">
<!--
 function CalculateTotals() {
 f=document.toylist;
 f.total1.value=parseInt(f.qty1.value)*9.99;
 f.total2.value=parseInt(f.qty2.value)*3.99;
 f.total3.value=parseInt(f.qty3.value)*11.99;
 f.total4.value=parseInt(f.qty4.value)*1.99;
 f.grandtotal.value=parseFloat(f.total1.value)
 +parseInt(f.total2.value)
 +parseInt(f.total3.value)
 +parseInt(f.total4.value);}//-->
 </script>
<body background="cldsbkg.gif">
<div id="Layer1" style="position:absolute; left:168px; top:128px; width:526px; height:68px; z-index:1">
  <p><font color="#8000FF" size="3"><strong>Here is a list of products that we
    currently supply:</strong></font><br />
  <strong><font color="#8000FF" size="2">(Please enter the quantity required
    &amp click submit when finished)</font></strong></p>
</div>


<div id="Layer2" style="position:absolute; left:152px; top:213px; width:576px; height:91px; z-index:2">
<form name="toylist" method="post">
    <table border="1">
      <tr>
        <th>Product</th>
        <th>Qty Available</th>
        <th>Price</th>
        <th>Qty Required</th>
        <th>Total</th>
      </tr>
      <tr>
        <td>Train Set</td>
        <td><div align="center">15</div></td>
        <td><div align="right">£9.99</div></td>
        <td><div align="right">
            <input name="qty1" onBlur="CalculateTotals()" value="0" size="15" />
          </div></td>
          <td><div align="right"><input name="total1" size="7"
               onFocus="document.toylist.qty2.select();
                         document.toylist.qty2.focus();" /></div></td>
      </tr>
       <tr>
        <td>Teddy Bear</td>
        <td><div align="center">30</div></td>
        <td><div align="right">£3.99</div></td>
        <td><div align="right">
            <input name="qty2" onBlur="CalculateTotals()" value="0" size="15" />
          </div></td>
          <td><div align="right"><input name="total2" size="7"
               onFocus="document.toylist.qty3.select();
                         document.toylist.qty3.focus();" /></div></td>
      </tr>
       <tr>
        <td>Junior Monopoly</td>
        <td><div align="center">5</div></td>
        <td><div align="right">£11.99</div></td>
        <td><div align="right">
            <input name="qty3" onBlur="CalculateTotals()" value="0" size="15" />
          </div></td>
          <td><div align="right"><input name="total3" size="7"
               onFocus="document.toylist.qty4.select();
                         document.toylist.qty4.focus();" /></div></td>
      </tr>
       <tr>
        <td>Barbie Doll</td>
        <td><div align="center">50</div></td>
        <td><div align="right">£1.99</div></td>
        <td><div align="right">
            <input name="qty4" onBlur="CalculateTotals()" value="0" size="15" />
          </div></td>
          <td><div align="right"><input name="total4" size="7"
               onFocus="document.toylist.qty1.select();
                         document.toylist.qty1.focus();" /></div></td>
      </tr>
       <tr><td></td><td></td><td></td><td>Grand Total</td><td><input name="grandtotal" size="7"
       onfocus="document.toylist.qty1.select();
       document.toylist.qty1.focus();" /></td></tr>
    </table>
     <br /><input type="submit" value="Submit" />
     
</form>

</div>
<table width="69%" border="1" align="center">
  <tr>
    <td><div align="center"><font color="#8000FF" size="7">ICA TOYS</font></div></td>
  </tr>
</table>
<p>&nbsp;</p>
<table width="16%" border="1" font color="#8000FF">
  <tr>
    <td><strong><font color="#8000FF" size="2">LOGIN</a></font></strong></td>
  </tr>
  <tr>
    <td><strong><font color="#8000FF" size="2"></a>NEW CUSTOMER</font></strong></td>
  </tr>
  <tr>
    <td><div align="left"><strong><font color="#8000FF" size="2"></a>TOY LIST</font></strong></div></td>
  </tr>
</table>

<p>&nbsp;</p>
</body>
</html>



0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those who don't know, Adobe Dreamweaver is a popular commercial web editor that enables you to design, build and manage complex websites. The editor is a WYSIWYG (What You See Is What You Get) web editor, which means that you can create your web…
Adobe Dreamweaver CS5 is a WYSIWYG web page editor that has advanced HTML, CSS, and Javascript rendering functionality and is probably the most well-known HTML editor available. Much of Dreamweaver's appeal centers around the Design View interfac…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question