/    Sign up×
Community /Pin to ProfileBookmark

help w/ Mortgage calulations

Hi,

I need help with a mortgage lab. The ShowVal or even maybe the OnClick is nor working correctly. Any help would be appreciated. I am new at this. Just learning.

Thanks,
Kim

[upl-file uuid=9dd9655c-7390-4cf9-80e0-6a08e98e4b40 size=855B]mortgage1.zip[/upl-file]

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@jaegernautApr 01.2004 — You aren't referencing the value of the form items, that's why it is problematic.

I also noticed that you aren't rounding to two decimal places on the payments. I've added code for that as well.

<i>
</i>&lt;script language="Javascript"&gt;

function Monthly(I, N, S) {
// I = yearly interest rate;
// N = number of monthly payments;
// S = loan amount;
return (S*I/12*Math.pow(I/12+1,N))/(Math.pow(I/12+1,N)-1);

}

function ShowVal() {
I=eval(document.mortgage.intrate.value); //added value
N=eval(document.mortgage.months.value); //added value
S=eval(document.mortgage.lamount.value); // added value
total=Monthly(I, N, S);
ttotal=total*N; // added for use in last line
document.mortgage.mpayment.value=total.toFixed(2); // setting 2 decimal places and added value
document.mortgage.tpayment.value=ttotal.toFixed(2); // setting 2 decimal places and added value
}

&lt;/script&gt;

Copy linkTweet thisAlerts:
@kimcliftauthorApr 01.2004 — Thanks for your help. It is now working - but I have some more code that needs to be added that I may need help with.


AGAIN - THANKS

I have been struggling with this for weeks!
Copy linkTweet thisAlerts:
@jaegernautApr 01.2004 — You're welcome.

Post again if you need more assistance.
×

Success!

Help @kimclift spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.5,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...