|
no...but I think the answer lies somewhere in the
javascript code and passing the variables to the cfoutput tag. the java
code is as follows...hope you can help or some other guru.
thanks
<SCRIPT
LANGUAGE="LiveScript">
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 = 0 + 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.downpayment.value == null || form.downpayment.value.length == 0) form.downpayment.value = 0; 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") || !checkNumber(form.downpayment, 0, form.principal.value, "Down payment")) { 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); form.payment.value = ((form.principal.value - form.downpayment.value) * pow * i) / (pow - 1) } function clearForm(form)
{
form.payments.value = ""; form.interest.value = "6"; form.principal.value = ""; form.downpayment.value = ""; } </SCRIPT>
|
- [CFTALKTor] Calculator Sean King
- Re: [CFTALKTor] Calculator Gustavo Jabbaz
- Sean King
