Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. var counter=setInterval(timer, 1000); //1000 will run it every 1 second
  2.  
  3. function timer()
  4. {
  5. count=count-1;
  6. if (count <= 0)
  7. {
  8. clearInterval(counter);
  9. return;
  10. }
  11.  
  12. document.getElementById("seconds").innerHTML = count + " secconds left!";
  13. }
  14.  
  15. //Trivia Game -- Final submitBtn
  16. function checkFinRes() {
  17.  
  18. var question1 = document.quiz.question1.value;
  19. var question2 = document.quiz.question2.value;
  20. var question3 = document.quiz.question3.value;
  21. var correct = 0;
  22.  
  23. if (question1 == "1943") {
  24. question1 = true;
  25. correct++;
  26. } else {
  27. question1 = false;
  28. }
  29.  
  30. if (question2 == "Bill Gates") {
  31. question2 = true;
  32. correct++;
  33. } else {
  34. question2 = false;
  35. }
  36.  
  37. if (question3 == "All of the above!") {
  38. question3 = true;
  39. correct++;
  40. } else {
  41. question3 = false;
  42. }
  43.  
  44.  
  45. document.getElementById("afterSub").style.visibility = "visible";
  46.  
  47.  
  48. document.getElementById("amtCorrect").innerHTML = "You got " + correct + "
  49. correct!";
  50.  
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement