r00t-err0r

math

Feb 13th, 2014
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var question = document.getElementById("question").innerHTML;
  2. var f = question[0]+question[1];
  3. if (question[2] == "-") {var radnja = question[2];}
  4. if (question[2] == "+") {var radnja = question[2];}
  5. if (question[4] != "=") {var s = question[3]+question[4];} else { var s = question[3]; }
  6. var rezultat = eval(f+radnja+s);
  7. var gotovo = question+rezultat;
  8. document.getElementById("answer").value=rezultat;
Advertisement
Add Comment
Please, Sign In to add comment