-
Notifications
You must be signed in to change notification settings - Fork 0
/
testBankCalculus.js
58 lines (53 loc) · 1.67 KB
/
testBankCalculus.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
var numberCorrect = 0;
function validateForm() {
var x = document.forms["calcTest"]["q1"].value;
console.log(x);
if (x == "b1") {
//alert("Question 1 was answered correctly!");
numberCorrect = numberCorrect + 1;
console.log("Number correct so far is " + numberCorrect);
return true;
}
else {
alert("Question 1 was answered incorrectly! Try again!");
return false;
}
}
function validateForm2() {
var y = document.forms["calcTest"]["q2"].value;
console.log(y);
if (y == "a2") {
//alert("Question 2 was answered correctly!");
numberCorrect = numberCorrect + 1;
console.log("Number correct so far is " + numberCorrect);
return true;
}
else {
alert("Question 2 was answered incorrectly! Try again!");
console.log("Number correct so far is " + numberCorrect);
return false;
}
}
function validateForm3() {
var z = document.forms["calcTest"]["q3"].value;
console.log(z);
if (z == "d3") {
//alert("Question 3 was answered correctly!");
numberCorrect = numberCorrect + 1;
console.log("Number correct so far is " + numberCorrect);
return true;
}
else {
alert("Question 3 was answered incorrectly! Try again!");
console.log("Number correct so far is " + numberCorrect);
return false;
}
}
function stopAlarm() {
if (validateForm() && validateForm2() && validateForm3()) {
document.getElementById("mp3").pause();
window.alert("The alarm will stop now.");
document.getElementById("home").style.visibility = "visible";
}
else location.reload(true);
}