Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
Solved

# Order Form totals

Posted on 2004-04-30
Medium Priority
204 Views
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>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
//-->
</script>
<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>
</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
Question by:studly1_uk
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
1 Comment

LVL 4

Accepted Solution

indigostark earned 200 total points
ID: 10959575
Here you go

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
//-->
</script>
<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>
</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

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…
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
###### Suggested Courses
Course of the Month11 days, 17 hours left to enroll