Solved

Order Form totals

Posted on 2004-04-30
1
194 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

757 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now