javascript works in mozilla but not ie

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • h3ktlk
    New Member
    • Mar 2008
    • 2

    javascript works in mozilla but not ie

    Please help Code is below

    [CODE=javascript]<script type="text/javascript">

    function BMI(h,w)
    {
    if (h.length==0 || w.length==0)
    {return ("")}
    if (h>0 && w>0)
    {return Math.round((w/Math.pow(h,2))* 703)}

    return ("")
    }

    function BMIPER(b,d,e,a, g)
    {

    if (d.length==0 || e.length==0)
    {return ("")}
    if (d>0 && e>0 && g=="M" && a<15)
    {return Math.round((1.5 1*b)-(0.70*a)-(3.6*1)+1.4)}
    if (d>0 && e>0 && g=="F" && a<15)
    {return Math.round((1.5 1*b)-(0.70*a)-(3.6*0)+1.4)}
    if (d>0 && e>0 && g=="F" && a>14)
    {return Math.round((1.2 0*b)-(0.23*a)-(10.8*0)+5.4)}
    if (d>0 && e>0 && g=="M" && a>14)
    {return Math.round((1.2 0*b)-(0.23*a)-(10.8*0)+5.4)}

    return ("")
    }

    function Calc_BMI()
    {
    for (i = 0; i <= 13; i++)

    document.getEle mentById("bmi_" +i).value = BMI(document.ge tElementById("h gt_"+i).value, document.getEle mentById("wgt_" +i).value)
    }


    function Calc_BMIper()
    {
    for (z = 0; z <= 13; z++)

    document.getEle mentById("bmi_p er_"+z).value = BMIPER(document .getElementById ("bmi_"+z).valu e, document.getEle mentById("hgt_" +z).value, document.getEle mentById("wgt_" +z).value, document.getEle mentById("age_" +z), document.getEle mentById("gen") .value)
    }


    </script>[/CODE]
    Last edited by acoder; Mar 18 '08, 12:11 PM. Reason: Added code tags
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Welcome to TSDN!

    You forgot .value for the "age" elements.

    Comment

    • h3ktlk
      New Member
      • Mar 2008
      • 2

      #3
      Thank you.

      and ahhh

      i swear i looked this over a zillion times.. lol I'm new to JS and it was just driving me crazy working one and not other.

      Thank you much!

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        You're welcome. Remember to check the error console. It would've pointed out the error.

        Comment

        Working...