?
Solved

Order Form totals

Posted on 2004-04-30
1
Medium Priority
?
205 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 200 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I still run into .cgi files every now and then. In some instances, I actually prefer the simplicity of a .cgi script to other options. Since I use DreamWeaver extensively, what I needed was a way to open .cgi scripts in Dreamweaver. And I wanted to …
This article is very specific and is only intended to help if you are installing Dreamweaver 8 in a Windows 7 environment with Office 2007 installed.   I'm not sure why Microsoft tends to release OS' that should not be released but they do.  Windows…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

839 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