Guest User

Untitled

a guest
Jul 16th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. else if(event.target.value == "=" && tal1 != null ){ //Om man trycker på =
  2. tal2 = parseInt(textBox.value);     //Anger tal2 till värdet av textBox
  3. if(math == "+"){    //Om addition har valts
  4.     resultat = tal1+tal2;       //Uträkningar
  5.     textBox.value = resultat;       //Sätter textBox till resultatatet
  6.     }
  7.     if(math == "-"){
  8.         resultat = tal1-tal2;
  9.         textBox.value = resultat;
  10.     }
  11.     else if(math == "*"){
  12.         resultat = tal1*tal2;
  13.         textBox.value = resultat;
  14.     }
  15.     else if(math == "/"){
  16.         resultat = tal1/tal2;
  17.         textBox.value = resultat;
  18.     }
  19.                
  20. }
Add Comment
Please, Sign In to add comment