Calculations on a Form

V

vinceg

I would like to offer a test on a form which will provide the viewer with a
result after they enter some values, and 'Click Here.'
I made up a simple form with 2 input fields, a hidden field with a
multiplier value in it, an answer field and 'Click Here' text item.
When the viewer enters their data, I want the 'Click Here' to add the 2
entered values, and multiply it by the hidden value, and then place the
result in the 'Total' field.
I presume the 'Click Here' click event would call a java script, bu I don't
know how to write it, where to place it, etc.

Any help you can provide will be appreciated. The code is below.

Thanks,

Vince G.

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>

<body>

<form>
<input type="hidden" name="T3" size="20" value="5"><p>Enter your first digit
here:
<input type="text" name="T1" size="20" value="0"></p>
<p>Enter your second digit here:
<input type="text" name="T2" size="20" value="0"></p>
<p>
</p>
<p>Click Here to get your answer</p>

<p>Your total will appear here:
<input type="text" name="Total" size="20" value="0"></p>


</form>

</body>

</html>
 
K

Kathleen Anderson [MVP - FrontPage]

Vince:
Rather than try and fit a solution into your page, I would suggest that you
try this: http://javascript.internet.com/math-related/ad-calculator.html or
any of the other examples on this page:
http://javascript.internet.com/math-related/ Pick it apart, look at the code
and figure out how it works. Then you'll be able to fit it into your form.

--

~ Kathleen Anderson
Microsoft MVP - FrontPage
Spider Web Woman Designs
web: http://www.spiderwebwoman.com/resources/
Please reply to the newsgroup for the benefit of others
 
V

vinceg

Kathleen,
That site has lots of great scripts, and I think I can piece together what I
need.
Thanks for the info.
 
T

Trevor Lawrence

vinceg said:
Kathleen,
That site has lots of great scripts, and I think I can piece together what
I
need.
Thanks for the info.

Yep, all good stuff.

Here is an example which does exactly what you asked for
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top