Solved

Order Form totals

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Download all files with one click 7 593
Extra Spacing In Pattern Matching 13 311
Rotating Adobe pdf document 4 310
Error pops up while using DWCSS 2015 11 152
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…
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 Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

910 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

19 Experts available now in Live!

Get 1:1 Help Now