-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweb.html
More file actions
90 lines (81 loc) · 2.35 KB
/
Copy pathweb.html
File metadata and controls
90 lines (81 loc) · 2.35 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Web IQ Test</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 40px;
background-color: #f4f4f4;
}
h1 {
text-align: center;
}
.question {
margin-bottom: 20px;
padding: 15px;
background: #fff;
border-radius: 8px;
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
button {
display: block;
margin: 20px auto;
padding: 10px 20px;
font-size: 16px;
background: #0078d7;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
}
button:hover {
background: #005a9e;
}
#result {
text-align: center;
font-size: 18px;
margin-top: 20px;
}
</style>
</head>
<body>
<h1>Web IQ Test</h1>
<form id="quizForm">
<div class="question">
<p>1. What does HTML stand for?</p>
<label><input type="radio" name="q1" value="0"> Hyper Trainer Marking Language</label><br>
<label><input type="radio" name="q1" value="1"> Hyper Text Markup Language</label><br>
<label><input type="radio" name="q1" value="0"> High Text Machine Language</label>
</div>
<div class="question">
<p>2. Which tag is used to create a hyperlink?</p>
<label><input type="radio" name="q2" value="1"> <a></label><br>
<label><input type="radio" name="q2" value="0"> <link></label><br>
<label><input type="radio" name="q2" value="0"> <href></label>
</div>
<div class="question">
<p>3. CSS is used for?</p>
<label><input type="radio" name="q3" value="0"> Adding logic</label><br>
<label><input type="radio" name="q3" value="1"> Styling web pages</label><br>
<label><input type="radio" name="q3" value="0"> Storing data</label>
</div>
<button type="button" onclick="calculateScore()">Submit</button>
</form>
<div id="result"></div>
<script>
function calculateScore() {
let score = 0;
const form = document.forms['quizForm'];
const totalQuestions = 3;
for (let i = 1; i <= totalQuestions; i++) {
const answer = form['q' + i].value;
score += parseInt(answer);
}
document.getElementById('result').innerText =
"Your score is " + score + " out of " + totalQuestions;
}
</script>
</body>
</html>