cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              
<html lang="en">

<head>
	<link href='https://fonts.googleapis.com/css?family=Homenaje' rel='stylesheet' type='text/css'>
	<link href='https://fonts.googleapis.com/css?family=Archivo+Black' rel='stylesheet' type='text/css'>
	<link rel="stylesheet" type="text/css" href="css/main.css">
</head>
<body>
	<div class="background"></div>
	<h1 class="title">Are You The Ultimate <span>Walking Dead</span> Fan?</h1>
	<form>
		<div class="questions">
			<h2 id="question0"></h2>
			<input id="answer0" type="text">
		</div>
		<div class="questions">
			<h2 id="question1"></h2>
			<input id="answer1" type="text">
		</div>
		<div class="questions">
			<h2 id="question2"></h2>
			<input id="answer2" type="text">
		</div>
		<div class="questions">
			<h2 id="question3"></h2>
			<input id="answer3" type="text">
		</div>
		<div class="questions">
			<h2 id="question4"></h2>
			<input id="answer4" type="text">
		</div>
		<div class="questions">
			<h2 id="question5"></h2>
			<input id="answer5" type="text">
		</div>
		<div class="questions">
			<h2 id="question6"></h2>
			<input id="answer6" type="text">
		</div>
		<button id="results" type="button" onclick="seeResults()">See Results</button>
	</form>
	<div id="result-output">
		<h3 id="correct" class="correct">Correct:</h3>
		<h3 id="wrong" class="wrong">Wrong:</h3>
	</div>
	<script type="text/javascript" src="js/main.js"></script>
</body>
</html>
            
          
!
            
              .background {
	background-image:url(http://u.jimdo.com/www62/o/s3805825086c29c7b/userlayout/img/hintergrund-infection-true2.jpg?t=1365438597);
	position:absolute;
	width:100%;
	height:1900px;
	left:-5px;
	top:0;
  background-repeat:no-repeat;
}
span {
	color:#F9F8E7;
	font-size:50px;
	text-shadow: 2px 2px 4px #000000;
}
.correct {
    text-shadow: 0px 0px 9px #00FF1A !important;
}
.wrong {
	text-shadow: 0px 0px 9px #FF0000 !important;
}
h1 {
	position:absolute;
	font-family:'Archivo Black', sans-serif;
	color:black;
	text-align:center;
	width:100%;
}
form {
	position:absolute;
	top:132px;
    margin-left: 50px;
	width:50%;
}
.questions {
	font-family:'Homenaje', sans-serif;
	text-align:center;
	color:#FFF2DC;
	text-shadow: 2px 2px 4px #000000;
	letter-spacing: 2px;
}
input {
	font-family:'Homenaje', sans-serif;
	text-align:center;
	font-weight: bold;
    width: 300px;
    height: 25px;
    font-size: 22px;
    letter-spacing: 2px;
}
button {
	background-color: #F9F8E7; 
	color: #000000;
	font-size: 20px;
	font-family:'Archivo Black', sans-serif;
    padding: 12px;
    margin-left: 42%;
    margin-top: 26px;
    border-style: none;

}
#result-output {
    position: absolute;
    right: 0;
    width: 34%;
    top: 25%;
}
h3 {
    font-family: 'Homenaje', sans-serif;
    text-align: left;
    color: #FFF2DC;
    letter-spacing: 2px;
    font-size: 73px;
    line-height: .3;
}
            
          
!
            
              //make an array of objects that have questions and the correct answers
var questions = [
	{
		question:"What is the name of the Governor's daughter",
		answer:"penny"
	},
	{
		question:"What did Andrea and Merele have in common at Woodbury",
		answer:"they were both abandoned by rick's group"
	},
	{
		question:"How long had the group gone without an accident in the Season 4 premiere",
		answer:"30 days"
	},
	{
		question:"What does hallucination Lori like to wear",
		answer:"a white dress"
	},
	{
		question:"Who claims he's worked on the Human Genome Project",
		answer:"eugene"
	},
	{
		question:"Who gives Carol a cherokee rose",
		answer:"daryll"
	},
	{
		question:"Where does Hershel go after the barn massacre",
		answer:"a bar"
	}
]

//check each object in the array(var questions) and change the question object to question1-7:
for (i = 0; i < questions.length; i++) {
	//go down the question list and add the number value that matches the questio list in the html
	qNum = questions[i].question
	//get the text content for each question 1-7:
	document.getElementById('question' + [i]).textContent = qNum
}

//write a function that returns the correct answers and changes the property of the questions
function seeResults() {
	//set the values of correct and wrong to 0
	var correct = 0;
	var wrong = 0;
	//write a for loop that increments up from question0 and count how many answers in the questions object array were correct or wrong
	for(i = 0; i < questions.length; i++) {	
		//state the answer in the list as a variable and go down the list
		var answer = questions[i].answer
		//retrieve the value of the user's input
		var userGuess = document.getElementById('answer' + [i]).value.toLowerCase()
		//check to see if the answer matches the question
		var questionColor = document.getElementById('question' + [i])
		//if the answer matches the userGuess and goes with the corresponding question, mark as correct and change the color to green
		if(answer == userGuess) {
			//add the class of wwrong that changes the questions that were right to green
			questionColor.className = 'correct'
			//move cown the list to add any other correct userGuess(s)
			correct++
		//otherwise if the answer doesnt match the userGuess, mark as wrong and change the question to red
		} else {
			//add the class of wwrong that changes the questions that were wrong to red
			questionColor.className = 'wrong'
			//move down the list and count how many wrong answers there were
			wrong++
		}
	}

	//add the number value of the correct answers to the result-output div
	document.getElementById('correct').textContent =  "Correct: " + correct
	document.getElementById('wrong').textContent =  "Wrong: " + wrong
}
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console