School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 300,489 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,812 people online right now. Registration is fast and FREE... Join Now!




Future Value Calculator

 

Future Value Calculator, Can not get Calculator to submit, when I click submit, the form goes b

4Steelers

14 Oct, 2008 - 08:58 AM
Post #1

New D.I.C Head
*

Joined: 14 Oct, 2008
Posts: 2

CODE
<html>
<head>
<style type="text/css">
<!--
body,td,th {
font-family: Adobe Caslon Pro;
font-size: 16px;
font-weight: bold;
color: #00FFFF;
}
body {
background-color: #000000;
margin-left: 25px;
margin-right: 25px;
margin-top: 25px;
margin-bottom: 25px;
}
a {
font-family: Courier New, Courier, monospace;
}
a:link {
color: #FFFFFF;
}
h1,h2,h3,h4,h5,h6 {
font-family: Geneva, Arial, Helvetica, sans-serif;
font-weight: bold;
}
h1 {
font-size: 18px;
color: #FFFFCC;
}
.style1 {color: #FFFFFF}
.style2 {color: #FFFFCC}
-->
</style>

<script Language="JavaScript">
<!-- Begin JavaScript -
function checkNumber(input, min, max, msg) {
msg = msg + " field has invalid data: " + input.value;
var str = input.value;
for (var i = 0; i < str.length; i++) {
var ch = str.substring(i, i + 1)
if ((ch < "0" || "9" < ch) && ch != '.') {
alert(msg);
return false;
      }
   }
var num = parseFloat(str)
if (num < min || max < num) {
alert(msg + " not in range [" + min + ".." + max + "]");
return false;
   }
input.value = str;
return true;
}
function computeField(input) {
if (input.value != null && input.value.length != 0)
input.value = "" + eval(input.value);
computeForm(input.form);
}
function computeForm(form) {
if ((form.payments.value == null || form.payments.value.length == 0) ||
(form.interest.value == null || form.interest.value.length == 0) ||
(form.principal.value == null || form.principal.value.length == 0)) {
return;
}
if (!checkNumber(form.payments, 1, 480, "# of payments") ||
!checkNumber(form.interest, .001, 99, "Interest") ||
!checkNumber(form.principal, 100, 10000000, "Principal")) {
form.payment.value = "Invalid";
return;
}
var i = form.interest.value;
if (i > 1.0) {
i = i / 100.0;
form.interest.value = i;
}
i /= 12;
var pow = 1;
for (var j = 0; j < form.payments.value; j++)
pow = pow * (1 + i);
money = "" + .01* Math.round(100*(form.principal.value * pow * i) / (pow - 1));
dec = money.indexOf(".");
dollars = money.substring(0,dec);
cents = money.substring(dec+1,dec+3);
cents = (cents.length < 2) ? cents + "0" : cents;
money = dollars + "." + cents;
form.payment.value = money;
}
function clearForm(form) {
form.payments.value = "";
form.interest.value = "";
form.principal.value = "";
}
// - End of JavaScript -->
</SCRIPT>

</HEAD>
<BODY>

<h3 align="center"><u><span class="style1">Future Value Calculator:</span></u></h3>
<blockquote></blockquote>
<p align="center" class="style1">
This type of calculator is used to determine what a sum of money deposited today will be<br />
worth at some point in the future based on a specific (interest) rate. Enter the<br />
dollar amount in which you wish to be deposited today, along with the interest <br />
rate and number of years it will be deposited for.</p>
<hr>
<center>
<form name="frm" method="get">
Present Value
  <input type="text" onchange="calcAmt(this.form)" maxlength="10" size="10" name="pv" tabindex="1"/>
Periodic Interest Rate
<input type="text" onchange="CalcAmt(this.form)" maxlength="6" size="6" name="pir" tabindex="2"/>
Number of Years
<input type="text" onchange="CalcAmt(this.form)" maxlength="5" size="5" name="nyr" tabindex="3"/>
<br>
<br>
<input type="submit" fvn="S(1+c)n;"calcamt(this.form)="" onclick="doMath(this.form);" size="10" value="Submit" name="calc" tabindex="4"/>
<input type="reset" value="Clear" tabindex="5">
<br>
<br>
Amount
<input type="text" name="amt" size="10" tabindex="6">
Interest
<input type="text" name=i"nter" size="10" tabindex="7">
</form>
</center>
<hr />
<div align="left">
    <blockquote></blockquote>
</div>
  <blockquote></blockquote>
<p><strong>If you are not able to view with Java/script or have it disabled, please click the link below.</strong></p>
<a href="http://1040tools.com/html/wc.dll?cptest1~calc~fv~my" class="style2" accesskey="s" tabindex="8">Link here if no javascript.</a>
</BODY>
</html>


Mod edit - Please code.gif
~BetaWar

User is offlineProfile CardPM
+Quote Post


BetaWar

RE: Future Value Calculator

14 Oct, 2008 - 02:22 PM
Post #2

#include <soul.h>
Group Icon

Joined: 7 Sep, 2006
Posts: 4,729



Thanked: 269 times
Dream Kudos: 1400
My Contributions
What exactly is the problem here?
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/8/09 04:14AM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month