[Javascript] Updating a text box - calculations (re-post)
Shawn Milochik
Shawn at Milochik.com
Wed Feb 2 17:26:04 CST 2005
Tim,
Here's a re-post. I hope this is useful.
Shawn
---------------------------------
Something like:
In the onKeyUp of any of the first five boxes, call a function like:
function addTotals(){
var dollarTotal = document.forms['moneyForm'].dol1.value +
document.forms['moneyForm'].dol2.value +
document.forms['moneyForm'].dol3.value +
document.forms['moneyForm'].dol4.value +
document.forms['moneyForm'].dol5.value;
document.forms['moneyForm'].twoPercent = dollarTotal * .02;
document.forms['moneyForm'].grandTotal = dollarTotal;
}
All this is untested, and I'm not bothering to round to two decimal
places here, although that will probably be your next step after getting
this stuff working.
Hope this helps.
Shawn
Tim Burgan wrote:
> Hi Milo,
>
> I'm actually still having trouble getting something to happen. If you
> could help that would be great.
>
> Tim
>
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
>
More information about the Javascript
mailing list