Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- else if(event.target.value == "=" && tal1 != null ){ //Om man trycker på =
- tal2 = parseInt(textBox.value); //Anger tal2 till värdet av textBox
- if(math == "+"){ //Om addition har valts
- resultat = tal1+tal2; //Uträkningar
- textBox.value = resultat; //Sätter textBox till resultatatet
- }
- if(math == "-"){
- resultat = tal1-tal2;
- textBox.value = resultat;
- }
- else if(math == "*"){
- resultat = tal1*tal2;
- textBox.value = resultat;
- }
- else if(math == "/"){
- resultat = tal1/tal2;
- textBox.value = resultat;
- }
- }
Add Comment
Please, Sign In to add comment