473,320 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

javascript works in mozilla but not ie

2
Please help Code is below

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2.  
  3. function BMI(h,w)
  4. {
  5.     if (h.length==0 || w.length==0)
  6.         {return ("")}
  7.                 if (h>0 && w>0)
  8.         {return Math.round((w/Math.pow(h,2))*703)}
  9.  
  10. return ("")            
  11. }
  12.  
  13. function BMIPER(b,d,e,a,g)
  14.  
  15.     if (d.length==0 || e.length==0)
  16.         {return ("")}
  17.                 if (d>0 && e>0 && g=="M" && a<15)
  18.         {return Math.round((1.51*b)-(0.70*a)-(3.6*1)+1.4)}
  19.     if (d>0 && e>0 && g=="F" && a<15)
  20.         {return Math.round((1.51*b)-(0.70*a)-(3.6*0)+1.4)}
  21.     if (d>0 && e>0 && g=="F" && a>14)    
  22.         {return Math.round((1.20*b)-(0.23*a)-(10.8*0)+5.4)}
  23.     if (d>0 && e>0 && g=="M" && a>14)    
  24.         {return Math.round((1.20*b)-(0.23*a)-(10.8*0)+5.4)}
  25.  
  26. return ("")
  27. }
  28.  
  29. function Calc_BMI()
  30. {
  31. for (i = 0; i <= 13; i++)
  32.  
  33. document.getElementById("bmi_"+i).value = BMI(document.getElementById("hgt_"+i).value, document.getElementById("wgt_"+i).value)
  34. }
  35.  
  36.  
  37. function Calc_BMIper()
  38. {
  39. for (z = 0; z <= 13; z++)
  40.  
  41. document.getElementById("bmi_per_"+z).value = BMIPER(document.getElementById("bmi_"+z).value, document.getElementById("hgt_"+z).value, document.getElementById("wgt_"+z).value, document.getElementById("age_"+z), document.getElementById("gen").value)
  42. }
  43.  
  44.  
  45. </script>
Mar 18 '08 #1
3 914
acoder
16,027 Expert Mod 8TB
Welcome to TSDN!

You forgot .value for the "age" elements.
Mar 18 '08 #2
h3ktlk
2
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!
Mar 18 '08 #3
acoder
16,027 Expert Mod 8TB
You're welcome. Remember to check the error console. It would've pointed out the error.
Mar 18 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

15
by: Peter Bremer | last post by:
Hi all, I've written this little piece of code, which doesn't seem to work in Mozilla 1.5. I haven't tried it on other Gecko browsers, but I've found some indication that Netscape 6+ has the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.