mercredi 25 novembre 2015

Validate condition statement (if else)

I am trying to validate my age but it doesn't seem to work.

However, this doesn't work. Is it ok to use 2 alert for condition statements? Because i am not really sure how this works.

 if (document.getElementById('male').checked) {

         tbmr = 66 + (13.7*weight) + (5*(height*100)) - (6.8*age);
     }




 else if (document.getElementById('female').checked){
          tbmr = 655 + (9.6*weight) + (1.8*(height*100)) - (4.7*age);
 }



 else if { 
    alert("please select your gender");


    }

else (age = null) {
    alert ("please enter you age")'

 } 

else if(!document.getElementById('male').checked {
 }



 localStorage.setItem("tbmr", tbmr);
 document.bmiform.submit();

 }

I'm not very sure of some codes and their placing so do help out alil here

Aucun commentaire:

Enregistrer un commentaire