Google Answers Logo
View Question
 
Q: html/javascript ( Answered,   0 Comments )
Question  
Subject: html/javascript
Category: Computers > Programming
Asked by: fuso-ga
List Price: $50.00
Posted: 29 Apr 2003 20:57 PDT
Expires: 29 May 2003 20:57 PDT
Question ID: 197311
Develop a mortgage calculator and amortization chart using html/javascript

Request for Question Clarification by j_philipp-ga on 29 Apr 2003 21:20 PDT
There are existing tools out there already. Would locating them for
you suffice as an answer, or is the emphasis on developing the tool on
our own?

Request for Question Clarification by dogbite-ga on 30 Apr 2003 06:40 PDT
Also, can you please provide more
  information on how you want the
  calculator and amortization chart
  to work?  Perhaps you even have
  a pointer to some websites that
  contain functionality close to 
  what you want.

            dogbite-ga

Clarification of Question by fuso-ga on 30 Apr 2003 21:16 PDT
I am not trying to calculate any mortgages or anything like that- I
need to develop this calculator just for the sake of developing it. If
you go to the website
www.kbapps.com/webdesign/calculators/mortgage.html you will find
exactly what I want.  I am having trouble forming that myself.  I can
cut and paste the code into wordpad but it becomes meaningless- I
can't get the form on the screen that allows the user to enter
information- I have no idea what to do after I type in the code.
Nothing happens. I basically was looking for someone to send me
exactly what you will see on the above website but without all the
kbapps stuff. I want to be able to use this calculator and view the
code (for learning purposes). The title on the form must say Alicia's
mortgage calculator.  The amortization table can be done in the same
way. I need this NO LATER than 10am on May 8th. I really appreciate
your response and especially your help.  If this is not clear enough
then let me know and I will get back to you ASAP.  Thanks again. 
fuso-ga
Answer  
Subject: Re: html/javascript
Answered By: kyrie26-ga on 30 Apr 2003 22:57 PDT
 
Hi there fuso-ga!

The code you saw in those two boxes are merely button links to the
Mortgage Calculator on the kbapps site. I launched the calculator by
clicking on the "Mortgage Calculator" button and got a popup window
with the correct form in it. I then proceeded to View Source and saved
it as my own file, mort_calc.htm. When I tried opening this file in my
browser, I got redirected to the kbapps site. Looking at the code, I
noticed there is some Javascript that causes the redirection if not
viewed off the kbapps site. I have taken out this code, and modified
it to say "Alicia's Mortgage Calculator". It is not very long, and I
have pasted it here :

+-----------------------------------------------------------------------------+

<html>
<head>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html;
charset=iso-8859-1">
<title>Alicia's Mortgage Calculator</title>
<style type="text/css">
  <!--
A:LINK    { COLOR :#FFFF00; TEXT-DECORATION:NONE;}
A:ACTIVE  { COLOR :#00FF00; TEXT-DECORATION:NONE;}
A:VISITED { COLOR :#FFFF00; TEXT-DECORATION:NONE;} 
A:HOVER   { COLOR :#80FF80; TEXT-DECORATION:UNDERLINE;}
  //-->
</style>

<script
LANGUAGE="JavaScript">
<!-- hide javascript
function calculate(){

	var PV = Number(document.forms[0].PV.value);
	var N = Number(document.forms[0].N.value);
	var i = Number(document.forms[0].i.value);

	var time = Number(document.forms[0].time.selectedIndex);

	var mPMT = 0;
	var tPMT = 0;
	var tINT = 0;

    if (i >= 1.0) { i = i / 100;}
	i = i / 12;
	
	if ( time == 1 ){ N = N;}
	if ( time == 0 ){ N = N * 12;}


	var x = 1 + i;

   mPMT = ( PV * Math.pow(x,N) ) / ( ( ( Math.pow(x,N) - 1 ) / i ) );
   tPMT = mPMT * N;
   tINT = tPMT - PV;

   document.forms[0].mPMT.value = Math.round( 100 * mPMT)/ 100;
   document.forms[0].tPMT.value = Math.round( 100 * tPMT)/ 100;
   document.forms[0].tINT.value = Math.round( 100 * tINT)/ 100;

}

// done hiding -->
</script>
<!-- end function -->
</head>

<body bgcolor="#FFFFFF" text="#000040" link="#FFFF00" vlink="#FFFF00"
alink="#00FF00">
<font size="5">Alicia's Mortgage Calculator<div align="left">

<table border="0" bgcolor="#FFFFFF" cellspacing="0" cellpadding="0"
width="250"
height="250">
  <tr>
    <td><form>
      <div align="center"><center><table border="0" cellpadding="3"
cellspacing="0">
        <tr>
          </font><td align="left" valign="middle"><div
align="left"><p>Loan Amount </td>
          <td><input name="PV" type="text" size="10"></td>
        </tr>
        <tr>
          <td>Interest (Annual)</td>
          <td><input name="i" type="text" size="10" value="8.00"></td>
        </tr>
        <tr>
          <td>Number of <select name="time" size="1">
            <option value="years">years</option>
            <option value="months">months</option>
          </select></td>
          <td><input name="N" type="text" value="40" size="3"></td>
        </tr>
        <tr>
          <td></td>
          <td><input TYPE="button" VALUE="Calculate"
onClick="calculate()"></td>
        </tr>
        <tr>
          <td>Monthly Payments</td>
          <td><input name="mPMT" type="text" size="10"></td>
        </tr>
        <tr>
          <td>Total of Payments</td>
          <td><input name="tPMT" type="text" size="10"></td>
        </tr>
        <tr>
          <td>Total Interest Paid</td>
          <td><input name="tINT" type="text" size="10"></td>
        </tr>
      </table>
      </center></div>
    </form>
    </td>
  </tr>
</table>
</div>
</body>
</html>

+-----------------------------------------------------------------------------+

Go ahead and save the above code as a .htm file, and try opening it.
Have fun learning! Let me know if you need any further help.


Regards,

kyrie26-ga
Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy