#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Posts
    2
    Rep Power
    0

    Javascript in form don't work can you help?


    HTML form in Frontpage 2000 using javascript for the maths, line 8 & line 9 won't work. You can find a near working example of this form attached or the original at http://www.brownandsharpe.com/justification/default.asp
    I am trying to modify this to Sterling instead of Dollars and use javascript / HTML instead of asp.
    The lines that don't work are "Payback in Months & Payback in years".

    <script language="JavaScript">
    function f_calc()
    {
    var res;


    res = document.CMM.R1a.value * document.CMM.R1b.value * document.CMM.R1c.value;
    document.all.tot.innerText = res;
    document.all.tot2.innerText = res*0.40;
    recalc();
    }

    function f_calc2()
    {
    var res;


    res = document.CMM.R2a.value * document.CMM.R2b.value * document.CMM.R2c.value;
    document.all.tot3.innerText = roundit(res);
    document.all.tot4.innerText = roundit(res*1);
    recalc();
    }

    function f_calc3()
    {
    var res;


    res = document.CMM.R3a.value * document.CMM.R3b.value * document.CMM.R3c.value;
    document.all.tot5.innerText = roundit(res);
    document.all.tot6.innerText = roundit(res*0.25);
    recalc();
    }

    function f_calc4()
    {
    var res;


    document.all.tot7.innerText = roundit(document.CMM.R4a.value*0.25);
    recalc();
    }

    function f_calc5()
    {
    var res;


    document.all.tot8.innerText = roundit(document.CMM.R6a.value*0.05);
    recalc();
    }

    function f_calc6()
    {
    var res;


    document.all.tot9.innerText = roundit(document.CMM.R7a.value*0.20);
    recalc();
    }

    function f_calc7()
    {
    var res;

    res = document.CMM.R8a.value;
    res /= parseInt(document.all.savemonth2.innerText);
    document.all.savemonth3.InnerText = res;
    alert(res);
    }


    function roundit( number )
    {
    return Math.round(number*100)/100;
    }


    function recalc()
    {
    var res;

    res = parseInt(document.all.tot2.innerText);
    res += parseInt(document.all.tot4.innerText);
    res += parseInt(document.all.tot6.innerText);
    res += parseInt(document.all.tot7.innerText);
    res += parseInt(document.all.tot8.innerText);
    res += parseInt(document.all.tot9.innerText);

    document.all.savemonth.innerText = res;
    document.all.savemonth2.innerText = res;

    }

    </script>
    Attached Files

IMN logo majestic logo threadwatch logo seochat tools logo