Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Java Problem

Options
  • 13-03-2008 4:10pm
    #1
    Registered Users Posts: 598 ✭✭✭


    I'm havint a problem with the following code:
    function CalcMORB(form){
    var m;
    z = eval(form.zapa.value)
    z = 5.91 + (0.16*z)
    m = eval(form.zapaa.value)
    m = (0.19*m)
    z = (z + m) + " %"
    form.zmorb.value = z
    return z
    }

    }
    function CalcMort(form){
    var t; var y
    z = eval(form.zapa.value)
    z = (0.1692*z)-9.065
    t = eval(form.zapaa.value)
    y = eval(form.zapat.value)
    z =(t*0.155) + z
    z = 1/(1+Math.exp(-z))
    z = Fmt(100 * z + y) + " %"
    form.zmort.value = z
    return z
    }


    function Fmt(x) {
    var v
    if(x>=0) { v=''+(x+0.05) } else { v=''+(x-0.05) }
    return v.substring(0,v.indexOf('.')+2)
    }

    And the Html Part:
    <td width="215" height="40"><div align="right"><font size="2" face="Arial">
    <input name="zmorb" type="text" class="grandvalue" value="0" size="2" />
    </font></div></td>
    <td width="215" height="40"><div align="right"><font size="2" face="Arial">
    <input name="zmort" type="text" class="grandvalue" value="0" size="2" />
    </font></div></td>

    Both of these functions are called when the person selects their age. Basically, zmort works perfectly and will update but zmorb just stays on Zero.
    If I change zmorb to be the value zmort, both the values will stay on zero. I'm a newbie to java so I'm after getting thrown in the deep end.
    Can anyone see what I'm doing wrong here?


Comments

  • Registered Users Posts: 598 ✭✭✭arseagon


    Doh, now there's a n00b mistake. It should have been CalcMorb not CalcMORB.


  • Registered Users Posts: 189 ✭✭MeWantBroadband


    Your problem begins with the fact that you do not know the difference between Java and Javascript.

    Do your own homework.


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    The OP's post didn't break any forum rules, and there's nothing wrong with being new to programming.


Advertisement