Click to See Complete Forum and Search --> : Form Calculator


gildedsplinters
02-23-2003, 06:09 PM
I have asked this a few times, but I am unsure if anyone understands. The calculator is found at http://www.arrowheadgloves.com/form.htm.

The calculator does exactly what I want it to do. In row 1 it multiplies ___ X 60 and =___. In row 2 it does the same thing but multiplies by 72, so __ X 72 = ___ . In row three it takes the numbers generated by rows one and two and adds them up.

What I want it to do is exactly what it does but without the calculate button and the calculate total button. I just want it to calculate without having to push any buttons.

Any and all help will of course be appreciated!

pyro
02-23-2003, 06:17 PM
Change your input box code to this for the first one

<input name="value1" size="12" onChange="add();add3();">

and

<input name="value2" size="12" onChange="add2();add3();">

for the second one.

khalidali63
02-23-2003, 06:55 PM
Or you can try this as well..
:-)

Cheers

Khalid


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-5">
<meta name="Author" content="Khalid Ali">
<title>
Untitled
</title>
<style type="text/css">

</style>
<script type="text/javascript">

function process(obj,elId){
var price = parseInt(obj.id);
var quantity = 0;
var temp = obj.value;
var stotalObj = eval('document.form1.subtotal'+elId);
var stotal = (stotalObj.value=="")?0:parseInt(stotalObj.value);
if(temp!=""){
if(!isNaN(parseInt(temp))){
stotal= (parseInt(temp)*price);
stotalObj.value = stotal;
}else{
alert("Field ["+obj.name+"] has a none integer value.");
}
}else{
alert("Field ["+obj.name+"] is empty.");
}
}
</script>
</head>
<body>
<table>
<tr>
<td width="240">
<font size="2"><font face=
"Verdana, Arial, Helvetica, sans-serif">1</font><font size="2"
face="Verdana, Arial, Helvetica, sans-serif">. I want to
order:</font></font>
</td>
<td width="87">
<div align="center">
<font size="2" face="Verdana, Arial, Helvetica, sans-serif">#
of Cases</font>
</div>
</td>
<td width="113">
<div align="center">
<font size="2" face=
"Verdana, Arial, Helvetica, sans-serif">Price Per Case</font>
</div>
</td>
<td width="185">
<div align="left">
<font size="2" face=
"Verdana, Arial, Helvetica, sans-serif">Total in Dollars<br>
</font>
</div>
</td>
</tr>
<tr>
<td height="173">
<p>
<font size="2"><font face=
"Verdana, Arial, Helvetica, sans-serif">Mens Gloves (2 doz.
per case)</font></font><font size="2"><font face=
"Verdana, Arial, Helvetica, sans-serif"><br>
<br>
<br>
</font> <font size="2"><font face=
"Verdana, Arial, Helvetica, sans-serif">Women's Gloves (3
doz. per case)<br>
</font></font> <font face=
"Verdana, Arial, Helvetica, sans-serif"><br>
<br>
<br>
</font></font>
</p>
<p>
&nbsp;
</p>
<p>
&nbsp;
</p>
</td>
<td colspan="3">
<form action="" name="form1">
<p align="left">
<input name="value1" id="60" size="12" onkeyup="process(this,1);"> <font size="2" face=
"Verdana, Arial, Helvetica, sans-serif">x$60.00 =$</font>
<input name="subtotal1" size="10"><br>
<br>
<input name="value2" id="72" size="12" onkeyup="process(this,2);"> <font size="2" face=
"Verdana, Arial, Helvetica, sans-serif">x$72.00 =$</font>
<input name="subtotal2" size="10">
</p>
</form>
</td>
</tr>
</table>
</body>
</html>

gildedsplinters
02-23-2003, 07:00 PM
As a designer trying to learn Java I must say, THANK YOU BOTH for your assistance!!

As I always say, any and all help is always appreciated!

Jonathan