Created
November 6, 2018 16:23
-
-
Save tilhom/47943956b6d21271edeb7330c2f8f17c to your computer and use it in GitHub Desktop.
script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function submitAnswers() { | |
var score = 0, total = 5; | |
var q1 = document.forms["quizForm"]["q1"].value; | |
var q2 = document.forms["quizForm"]["q2"].value; | |
var q3 = document.forms["quizForm"]["q3"].value; | |
var q4 = document.forms["quizForm"]["q4"].value; | |
var q5 = document.forms["quizForm"]["q5"].value; | |
console.log(q1,q2,q3,q4,q5); | |
// Validation | |
for(i = 1; i <= total;i++){ | |
if(eval('q'+i) == null || eval('q'+i) == ''){ | |
alert('You missed question '+ i); | |
return false; | |
} | |
} | |
alert('Ваш результат '+score+' из ' +total + ' вопросов'); | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment