1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: Javascript Calculation Doesn't Work in IE

Discussion in 'Web Design & Development' started by WendyM, Apr 3, 2015.

Thread Status:
Not open for further replies.
Advertisement
  1. WendyM

    WendyM Retired Trusted Advisor Thread Starter

    Joined:
    Jun 27, 2003
    Messages:
    4,042
    Hi all,
    I'm a novice when it comes to Javascript and generally just cobble together things from other sources until it works the way I want. I have some JS that calculates a couple of different fees, based on the amounts entered. This works just fine in Chrome, but doesn't do anything in IE. Any ideas why? Thanks for any help.

    Code:
    <script type="text/javascript">
    
    function getFees(form) {
    //Constant Variables
        const app = Number (0.0005);
        const admin = Number (.004);
    
    //QP
        var qpTotal = Number(form.qpTotal.value);
        var qpReport = Number(form.qpReport.value);
        var appFee = qpTotal * app;
        var adminTotal = qpTotal * admin
        var adminReport = qpReport * admin
        var adminReportCap = adminTotal - 15000
    	
        if (appFee < 250) {form.appResult.value = 250
    	} else 
    	if (appFee >10000) {form.appResult.value = 10000
    	} else 	
    	{form.appResult.value = appFee;
    	}
    	
    	if (adminTotal < 15000) {form.adminTotalResult.value = 15000
    	} else 
    	if (adminTotal >350000) {form.adminTotalResult.value=350000
    	} 	else 	
    	{form.adminTotalResult.value = adminTotal;}
    	
    	if (adminReport > adminReportCap) {form.adminReportResult.value=adminReportCap}
    	else 	
    	{form.adminReportResult.value = adminReport;}
    }
    
    </script> 
    
    <h3>Fee Calculator</h3>
    
    <form name="fee">
    
    
    <table cellpadding="3" cellspacing="3">
    <tr>
    	<td>Total Amount of Qualified Property Purchased</td>
        <td>$ <INPUT  class="input" TYPE="text"  NAME="qpTotal"> </td>
    </tr>
    <tr>
    	<td>Amount of Qualified Property Purchased in Last Reporting Period</td>
        <td>$ <INPUT  class="input" TYPE="text"  NAME="qpReport"> </td>
    </tr>
    <tr>
    	<td colspan="2" class="center"><input name="Calculate" type="button" value="Calculate" onclick="getFees(form)"/></td>
    </tr>
    <tr>
    	<td>Application Fee:</td>
        <td>$ <input name="appResult" disabled="disabled"/></td>
    </tr>
    <tr>
      <td>Total Administration Fee:</td>
      <td>$
        <input name="adminTotalResult" disabled="disabled"/></td>
    </tr>
    <tr>
    	<td>Administration Fee Due for Reporting Period:</td>
        <td>$ <input name="adminReportResult" disabled="disabled"/></td>
    </tr>
    </table>
    
     
  2. ckphilli

    ckphilli

    Joined:
    Apr 29, 2006
    Messages:
    4,393
  3. WendyM

    WendyM Retired Trusted Advisor Thread Starter

    Joined:
    Jun 27, 2003
    Messages:
    4,042
    Guam Chris! How the heck are you?

    You, sir, are a gentleman and a scholar. Works like a charm. Thanks much. (y)
     
  4. ckphilli

    ckphilli

    Joined:
    Apr 29, 2006
    Messages:
    4,393
    Good to hear! I'm great :) Hope the same for you!
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Similar Threads - Solved Javascript Calculation
  1. Ravikumar112
    Replies:
    1
    Views:
    118
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1145957

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice