Quiz

Developer
Size
2,224 Kb
Views
4,048

How do I make an quiz?

What is a quiz? How do you make a quiz? This script and codes were developed by Tom on 11 January 2023, Wednesday.

Quiz Previews

Quiz - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Quiz</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <html>
<head>
</head>
<body id="grad">
<div class="wrapper">	<h1>Quiz</h1>	<button id="quiz-1">Press to play the space quiz</button>	<div id="result-1"></div>	</div>
</body>
</html> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Quiz - Script Codes CSS Codes

#grad { background: #3f3c78; /* For browsers that do not support gradients */ background: -webkit-linear-gradient(#3f3c78, #8482b2); /* For Safari 5.1 to 6.0 */ background: -o-linear-gradient(#3f3c78, #8482b2); /* For Opera 11.1 to 12.0 */ background: -moz-linear-gradient(#3f3c78, #8482b2); /* For Firefox 3.6 to 15 */ background: linear-gradient(#3f3c78, #8482b2); /* Standard syntax */
}
body {	font-family: arial;	height: 800px;
}
.wrapper {	width: 800px;	margin: auto;
}
button {	font-size: 1.5em;	border-radius: 6px;	background: #8482b2;
}
#results-1 {	colour: #19194A;	font-size: 2em;
}

Quiz - Script Codes JS Codes

$(document).ready(function() {	$("#quiz-1").click(function() {	// Variables var score = 0; var questions = [ ['How many moons does the earth have?', 1], ['How many moons does saturn have?', 31], ['How many moons does Venus have?', 0] ]; // Functions function askQuestion(question){ var answer = prompt(question[0], ''); if (answer == question[1]) { alert('Correct!'); score++; } else { alert('Sorry. The correct answer is ' + question[1]); } } // Loops for (var i=0; i<questions.length; i++) { askQuestion(questions[i]); }	$( '#result-1').html('<p>You scored ' + score + ' out of ' + questions.length + '</p>');	});
});
Quiz - Script Codes
Quiz - Script Codes
Home Page Home
Developer Tom
Username tomltd
Uploaded January 11, 2023
Rating 3
Size 2,224 Kb
Views 4,048
Do you need developer help for Quiz?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Tom (tomltd) Script Codes
Create amazing sales emails with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!