Jason64
11-26-2003, 09:40 AM
I would like to create a JavaScript that uses 4 text fields and 1 hidden field(which would contain a static number) and dynamically, on the fly, as you type, adds or multiplies. Is this even possible? Here's how it would break down:
The Static field, (a hidden field with a value.):
Let's say that number is $100,000.00, would be visible.(above the other fields in a list)
1st text field:
a dollar amount. Initial value zero. will contain a decimal (in dollars) ie: $4,000.00
2nd text field:
a percent. initial value zero. also will contain a decimal (in dollars) ie: 4.00%
3rd text field:
another dollar amount. initial value zero. will contain a decimal (in dollars) $50.00
4th and last text field:
TOTAL dollar amount. EQUALS the values entered into the 3 above fields based on the static field of $100,000.00. will contain a decimal (in dollars)
How these fields would interact:
The static field would be the "known" number. All other fields would be based off of this number. Each of the 4 fields would begin with a value of zero dollars or percent. Once the user enters a value into ANY of the 4 fields the code should do the math based on the initial value: $100,000.00, ON THE FLY WITHOUT REFRESHING.
Visual:
$100,000.00
$[__4,000.00__]
[__4.00___]%
$[__50.00__] per hour
$[__TOTAL__]
Please reply, Your help is greatly appreciated!
Jason64
The Static field, (a hidden field with a value.):
Let's say that number is $100,000.00, would be visible.(above the other fields in a list)
1st text field:
a dollar amount. Initial value zero. will contain a decimal (in dollars) ie: $4,000.00
2nd text field:
a percent. initial value zero. also will contain a decimal (in dollars) ie: 4.00%
3rd text field:
another dollar amount. initial value zero. will contain a decimal (in dollars) $50.00
4th and last text field:
TOTAL dollar amount. EQUALS the values entered into the 3 above fields based on the static field of $100,000.00. will contain a decimal (in dollars)
How these fields would interact:
The static field would be the "known" number. All other fields would be based off of this number. Each of the 4 fields would begin with a value of zero dollars or percent. Once the user enters a value into ANY of the 4 fields the code should do the math based on the initial value: $100,000.00, ON THE FLY WITHOUT REFRESHING.
Visual:
$100,000.00
$[__4,000.00__]
[__4.00___]%
$[__50.00__] per hour
$[__TOTAL__]
Please reply, Your help is greatly appreciated!
Jason64