www.webdeveloper.com
Recent Articles
  • Finding Slow Running Queries in ASE 15
  • A More Advanced Pie Chart for Analysis Services Data
  • Adobe AIR Programming Unleashed: Working with Windows
  • Performance Testing SQL Server 2008's Change Data Capture Functionality
  • The ABC's of PHP: Introduction to PHP
  • How to Migrate from BasicFiles to SecureFiles Storage
  • Why the Twitter Haters Are Wrong
  • User Personalization with PHP: Beginning the Application
  • Whats in an Oracle Schema?
  • Lighting Enhancement in Photoshop
  •  

    Go Back   WebDeveloper.com > Client-Side Development > JavaScript

    JavaScript JavaScript (not Java) Discussion and technical support, including AJAX and frameworks (JQuery, MooTools, Prototype...)

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1  
    Old 04-01-2004, 08:56 AM
    kimclift kimclift is offline
    Registered User
     
    Join Date: Mar 2004
    Posts: 6
    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
    Attached Files
    File Type: zip mortgage1.zip (855 Bytes, 58 views)
    Reply With Quote
      #2  
    Old 04-01-2004, 10:05 AM
    jaegernaut jaegernaut is offline
    Registered User
     
    Join Date: Dec 2003
    Location: Dallas, Texas
    Posts: 256
    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.

    Code:
    <script language="Javascript">
    
    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
    }
    
    </script>
    __________________
    Thanks,

    Jaegernaut
    ----------------------
    "We cannot solve the problems we have created with the same type of thinking that has created them."
    - Einstein

    "Rarely do we get enough information from a poster to be able to say the best possible way to code something, but no matter what, we should encourage research, education, and respect among our communities."
    -- Me
    Reply With Quote
      #3  
    Old 04-01-2004, 11:17 AM
    kimclift kimclift is offline
    Registered User
     
    Join Date: Mar 2004
    Posts: 6
    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!
    Reply With Quote
      #4  
    Old 04-01-2004, 11:19 AM
    jaegernaut jaegernaut is offline
    Registered User
     
    Join Date: Dec 2003
    Location: Dallas, Texas
    Posts: 256
    You're welcome.

    Post again if you need more assistance.
    __________________
    Thanks,

    Jaegernaut
    ----------------------
    "We cannot solve the problems we have created with the same type of thinking that has created them."
    - Einstein

    "Rarely do we get enough information from a poster to be able to say the best possible way to code something, but no matter what, we should encourage research, education, and respect among our communities."
    -- Me
    Reply With Quote
    Reply

    Bookmarks


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is Off
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 06:05 PM.



    Acceptable Use Policy

    internet.comMediabistrojusttechjobs.comGraphics.com

    WebMediaBrands Corporate Info


    Advertise | Newsletters | Feedback | Submit News

    Legal Notices | Licensing | Permissions | Privacy Policy

    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.