Quiz
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 - 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>'); });
});
Developer | Tom |
Username | tomltd |
Uploaded | January 11, 2023 |
Rating | 3 |
Size | 2,224 Kb |
Views | 4,048 |
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!
Name | Size |
Presentations | 3,039 Kb |
Vue todo | 2,021 Kb |
Portfolio page my own framework | 2,306 Kb |
SVG with CSS House | 2,865 Kb |
Airpoints single faq | 37,929 Kb |
A Pen by Tom | 10,502 Kb |
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!
Name | Username | Size |
Minimelephant | Smashlee | 2,507 Kb |
Basecamp 3 Document | Lachlanjc | 3,811 Kb |
Twitch.tv API | Ryzokuken | 2,618 Kb |
Shopping List | Markmurray | 6,015 Kb |
Whyutils | LeYvan | 3,752 Kb |
Polygon Logo in CSS | Kai | 3,412 Kb |
Replace url via jquery | Serluk | 1,429 Kb |
Factorial | KeithleySLHS | 1,158 Kb |
A Pen by Moeid Saleem | Moeidsaleem | 1,862 Kb |
Reviews and Ratings Star | Zbnmstry | 1,591 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!