Click to See Complete Forum and Search --> : Script Help - math calculation
ShawnJ434
08-09-2003, 02:17 PM
I am using a script provided by JavaScriptsource.com that calculates amortization. When you type in the interest rate you must type it in .00 format...so 7.5% would be entered .075 - I would like to change it so that the user can just type 7.5 - If anyone can help me do this it would be greatly appreciated. You can find the page the script resides in at http://www.businesswits.net/amortization.htm or view the attached file.
Thanks
ShawnJ434
David Harrison
08-09-2003, 02:30 PM
Surely it would just be this:
IR = parseFloat(document.calcform.interest.value)/100;
So that if 7.5 was entered it would become 0.075.
David Harrison
08-09-2003, 03:54 PM
OK then try this:
IR = (parseFloat(document.calcform.interest.value))/100;
or:
IR = parseFloat(document.calcform.interest.value);
IR = IR/100;
David Harrison
08-09-2003, 04:36 PM
Well I don't know what the problem is then, try putting alerts in ie:
alert(IR);
to see whether or not the script is doing what it's supposed to and to find out when it isn't.
All I can tell you is that variable names are case sensitive as the attached script illustrates.
By the way you really should post your responses in here rather than as pm's so that others can follow the thread.
ShawnJ434
08-09-2003, 04:57 PM
Thanks to lavalamp for helping me. I was able to find a solution on my own. Problem solved.
Thanks
ShawnJ434
David Harrison
08-09-2003, 05:03 PM
I'm glad that you solved your problem. :)