-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsecond.html
104 lines (89 loc) · 2.01 KB
/
second.html
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Quiz</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
<script type="text/javascript" src="js/bootstrap.js"></script>
<SCRIPT language="JavaScript"
type="text/javascript">
<!--
//
// Documentation:
// http://chami.com/tips/javascript/
//
function checkAnswer(quizForm,
theAnswer,
urlRight,
urlWrong)
{
var s = "?";
// go through the "current choices"
// to find the selected choice.
// radio boxes pointing to choices
// must be named "cc"
// change if necessary
//
var i = 0;
for(;i<quizForm.elements.length;i++)
{
if(("cc" ==
quizForm.elements[i].name) &&
(quizForm.elements[i].checked))
{
s = quizForm.elements[i].value;
}
}
// no choice was selected
//
if("?" == s)
{
alert("Please make a selection.");
return false;
}
// check if we have the correct
// choice selected
//
if(s == theAnswer)
{
alert("'"+s+"' is correct!");
if(urlRight)
{
document.location.href = urlRight;
}
}
else
{
alert("'"+s+"' is incorrect.");
if( urlWrong )
{
document.location.href = urlWrong;
}
}
// return "false" to indicate not to
// submit the form.
// change this to "true" if the form
// "action" is valid,
// i.e. points to a valid CGI script
//
return false;
}
//-->
</SCRIPT>
</head>
<body bgcolor="gray">
What is JavaScript?
<FORM method="POST"
onSubmit="return checkAnswer(this,'B');"
>
<INPUT TYPE="RADIO" VALUE="A" NAME="cc">
A. Another name for Java<BR></BR></INPUT>
<INPUT TYPE="RADIO" VALUE="B" NAME="cc">
B. A scripting language mostly for the web<BR></BR></INPUT>
<INPUT TYPE="RADIO" VALUE="C" NAME="cc">
C. When you use Java without compiling<BR></BR></INPUT>
<INPUT TYPE="SUBMIT" VALUE="Submit Answer"></INPUT>
</FORM>
</body>
</html>