Click to See Complete Forum and Search --> : order form


WILLIE WALTON
12-14-2002, 10:11 PM
I am trying to construct
a order form using java script to calculate the totals when customers
submit their information.I was using the Sams JavaScript in 24 HRS
manual.I constructed my order form from the one in the book it didn't
work.AI also found a javascript programming language on this web site it
didn't work either.Here is the prgram that I used,can you look at it and
let me know, what I'am doing wrong.<HTML><HEAD><TITLE>YO!WILLIE
RECORDS</TITLE>

<Script language="JavaScript">
<!--
function calculateTotals(){
f=document.orderform;
f.total1.value=parseFloat(f.checkbox1.value)*50.00;
f.total2.value=parseFloat(f.checkbox2.value)*13.99;
f.total3.value=parseFloat(f.checkbox3.value)*13.99;
f.total4.value=parseFloat(f.checkbox4.value)*49.99;
f.grandtotal.value=parseFloat(f.total1.value)
+parseFloat(f.total2.value)
+parseFloat(f.total3.value)
+parseFloat(f.total4.value);}
//-->
</script>
</head><a
href="breakopening.html"><center><b>HOME</b></center></a></td><td><a
href="breakopening.html"><b></b></a></td></tr><TD>
</tbody></table>
<TABLE align=left border=30 height=30 width=30 table>

<TBODY>
<TR>
<TBODY>
<TR>
<TD><B>BREAKBEAT LP's <P><a href="breaka-z.html">A-Z</A></p>

<b>Book</p>
<a href="books1.html">A-Z</A></U>
</B></B></TD></TR></TBODY></TABLE>



</B></B></TD></TR></TBODY></TABLE>
<P></P>
<body>


<h1>Order Form</h1>
<p>Please indicate which record that you want to order in the
"CHECKBOX".The total amount of your order will be calculated
automatically.When you are ready to submit your order.
click on the <b>Make Purchase</b> button.</p>
<form name="orderform" method="post" action="C:\Documents and
Settings\WILLIE\My Documents\yowillie\breaka-f.html"><A
HREF=mailto:yowillie3@earthlink.net>E-mail me</A>

<pre>What is your name <input text="text"
id="fullname" size=50/>
What is your address <input text="text" id="address" size="50"/>
City<INPUT TEXT="text" id="city" size="25"/> State <input text="text"
id="state" size="25"/> Zip Code<input text="text" id="zip code"
size="25"/>
Your e-mail address<input type="text"
id="e-address"size="50"/>
</prep></p>
<table border="3"><tr>
<th>Checkbox</th><th>Title</th><th>Artist</th>
<th>Price</th><th>Total</th></tr>
<tr><td>
<input type="Checkbox" id="obo" size="3" OnBlur="calculateTotals()"
/></td>
<td><center>Kukurudu</center></td><td><center>Obo Addy</center></td>
<td align="right">$50.00</td>
<td><input name="total1"size="7"
OnFocus="document.orderform.checkbox1.select();
document.orderform.checkbox1.focus();"/></td></tr>

ShrineDesigns
12-15-2002, 12:19 AM
input elements do not need the "/" at the end
be sure to close all quotes; not id="myText
use the name attribute instead of id attribute to identify form elements

also you did not have the name attribute set for the checkbox and that is why the script failed

WILLIE WALTON
12-15-2002, 12:30 AM
shrine- Could you give me an example of what you mean ?
Boy that would help.

ShrineDesigns
12-15-2002, 12:35 AM
f.total1.value=parseFloat(f.checkbox1.value)*50.00;

<input type="Checkbox" id="obo" name="checkbox1" size="3" OnBlur="calculateTotals()">