multiply two form fields

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to calculate two form fields with in a form I am creating? I
would like to take the amount of one form field and multiply it with another
form field to show the answer in a third form field.
 
Yes, do a search in the IE address bar for the following:

? JavaScript Form Calculation Scripts

If use FP Form Field Validation, you will not be able to use both scripts at the same time without
combining the two scripts.

--
==============================================
Thomas A. Rowe
Microsoft MVP - FrontPage

http://www.Ecom-Data.com
==============================================
 
huh?

Thomas A. Rowe said:
Yes, do a search in the IE address bar for the following:

? JavaScript Form Calculation Scripts

If use FP Form Field Validation, you will not be able to use both scripts at the same time without
combining the two scripts.

--
==============================================
Thomas A. Rowe
Microsoft MVP - FrontPage

http://www.Ecom-Data.com
==============================================
 
Correction:
If YOU use FP Form Field Validation IN YOUR FORM, you will not be able to use both scripts (the form
calculation script, that you currently need, and the FP Form Field Validation script) at the same
time without combining the two scripts.

--
==============================================
Thomas A. Rowe
Microsoft MVP - FrontPage

http://www.Ecom-Data.com
==============================================
 
Not sure if this will accomplish what you want.

From a post earlier this month.

On this line, substitute the proper mathematical symbol for the plus
sign between the two "number value" fields to accomplish the function
you wish the script to perform:

Add = { result.value = +number1.value + +number2.value}
Mulitply = { result.value = +number1.value * +number2.value}
Subtract - { result.value = +number1.value - +number2.value}
Divide = { result.value = +number1.value / +number2.value}

------------------------>
in
message news:D[email protected]...
I'm making a little page were I need the page to calculate. How can I do
that?

Try this

<html>
<head>
<script type="text/javascript">
function calcform()
{
with (document.form1)
{ result.value = +number1.value + +number2.value}
/*Note the extra + operator before each value. This is needed to
convert the
value from a string to a number.*/
}
</script>
</head>
<body>

Sum of Two Numbers
<form name="form1" action="">
Number 1:<br />
<input type="text" id="number1" value="" size="40" /><br/>
Number 2:<br />
<input type="text" id="number2" value="" size="40" /><br/>
Sum:<br />
<input type="text" id="result" value="" size="40" /><br/>

<input type="button" id="Calculate" value="Calculate"
onclick="calcform()" />
<input type="reset" id="reset" value=" Clear "/>
</form>

</body>
</html>
 
Sorry, I did not properly attribute this post when I copy/pasted it.
The script was originally posted by:
 
IdaSpode said:
Sorry, I did not properly attribute this post when I copy/pasted it.
The script was originally posted by:

Thanks for the attribution, but I am just happy that you replied. I was
going to do so, but I got caught up with some other things
 
Back
Top