Skip to content

Instantly share code, notes, and snippets.

@marcusp619
Created May 13, 2015 20:57
Show Gist options
  • Save marcusp619/3131cf25f86ad9f96e4c to your computer and use it in GitHub Desktop.
Save marcusp619/3131cf25f86ad9f96e4c to your computer and use it in GitHub Desktop.
bdprQN
<body>
<div class="container">
<h1>The Ultimate Quiz Challenge</h1>
<script src="quiz.js"></script>
</div>
</body>
</html>
var score = 0;
var q1 = prompt("what is 2 + 2?");
if (q1 === "4") {
score += 1;
document.write("<p>You're absolutely correct!</p>");
} else {
document.write("<p>Sorry you're wrong</p>");
}
var q2 = prompt("What is 9 * 9?");
if (q2 === "81") {
score += 1;
document.write("<p>You're absolutely correct!</p>");
} else {
document.write("<p>Sorry you're wrong</p>");
}
var q3 = prompt("What shape is an apple?");
if (q3.toUpperCase() === 'CIRCLE') {
score += 1;
document.write("<p>You're absolutely correct!</p>");
} else {
document.write("<p>Sorry you're wrong</p>");
}
var q4 = prompt("What color is #fff");
if (q4.toUpperCase() === 'WHITE') {
score += 1;
document.write("<p>You're absolutely correct!</p>");
} else {
document.write("<p>Sorry you're wrong</p>");
}
var q5 = prompt("What color is #000?");
if (q5.toUpperCase() === 'BLACK') {
score += 1;
document.write("<p>You're absolutely correct!</p>");
} else {
document.write("<p>Sorry you're wrong</p>");
}
// TOTAL SCORED
document.write("<p>Your total score is: </p>" + score);
// THE RESULTS RANK
if (score > 4) {
document.write("<p><strong>You get a GOLD Crown!</strong></p>");
} else if (score >= 3) {
document.write("<p>You get a SILVER Crown!</p>");
} else if (score >= 1) {
document.write("<p>You get a BRONZE Crown!</p>");
} else if (score < 1) {
document.write("<p>Sorry you did not earn a crown</p>");
}
html,
body,
div,
h1,
h2,
p,
ul,
section {
margin: 0;
padding: 0;
border: 0;
font: inherit;
font-size: 100%;
vertical-align: baseline;
}
html {
line-height: 1;
}
ul {
list-style: none;
}
section {
display: block;
}
body {
background: #edeff0;
padding: 50px 0 0;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 62.5%;
text-align: center;
}
h1,
h2 {
font-size: 2.4em;
font-weight: 400;
margin-bottom: 8px;
color: #384047;
line-height: 1.2;
}
h2 {
font-size: 1.8em;
}
p {
color: #8d9aa5;
font-size: 1.4em;
margin-bottom: 15px;
line-height: 1.4;
}
.container {
box-sizing: border-box;
width: 90%;
max-width: 1080px;
background: white;
padding: 30px 15px;
margin: 0 auto;
position: relative;
overflow: hidden;
border-radius: 5px;
-webkit-box-shadow: 0 1px 0 0 rgba(0, 0, 0, 0.1);
-moz-box-shadow: 0 1px 0 0 rgba(0, 0, 0, 0.1);
box-shadow: 0 1px 0 0 rgba(0, 0, 0, 0.1);
}
.button {
background: #3f8abf;
padding: 8px 18px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 1.4em;
color: white;
font-weight: 500;
border: 3px solid #3f8abf;
outline: none;
cursor: pointer;
display: -moz-inline-stack;
display: inline-block;
vertical-align: middle;
*vertical-align: auto;
zoom: 1;
*display: inline;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
-ms-border-radius: 5px;
-o-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: 0 2px 0 0 #3574a0;
-moz-box-shadow: 0 2px 0 0 #3574a0;
box-shadow: 0 2px 0 0 #3574a0;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
-o-transition: 0.3s;
transition: 0.3s;
}
.button:hover {
background: #397cac;
border-color: #397cac;
-webkit-box-shadow: 0 2px 0 0 #2c6085;
-moz-box-shadow: 0 2px 0 0 #2c6085;
box-shadow: 0 2px 0 0 #2c6085;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment