Benutzer:Janka/Frag-O-Mat

aus Wikipedia, der freien Enzyklopädie
Zur Navigation springen Zur Suche springen

Nach einem solchen Frag-O-Mat wurde am 13.12.2010 in der Auskunft gefragt.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>Frag-O-Mat</title>
	<meta name="author" content="Frag-O-Mat Team">
	<script type="text/javascript">
		function clear_topics () {
			for (var i = 0; i < document.getElementsByName("topic").length; i++) {
					document.getElementsByName("topic")[i].style.display = "none";
				}
		}

		function select_topic (topic) {
			clear_topics();
	 		document.getElementById(topic).style.display = "block";
		}

		function select_result () {
			clear_topics();

			score_a = 0;
			score_b = 0;
			score_c = 0;

			if (document.topics.topic1[0].checked) { score_a = score_a + 1 }
			if (document.topics.topic1[1].checked) { score_b = score_b + 1 }
			if (document.topics.topic1[2].checked) { score_c = score_c + 1 }

			if (document.topics.topic2[0].checked) { score_a = score_a + 1 }
			if (document.topics.topic2[1].checked) { score_b = score_b + 1 }
			if (document.topics.topic2[2].checked) { score_c = score_c + 1 }

			if (document.topics.topic3[0].checked) { score_a = score_a + 1 }
			if (document.topics.topic3[1].checked) { score_b = score_b + 1 }
			if (document.topics.topic3[2].checked) { score_c = score_c + 1 }

			if (score_a > score_b && score_a > score_c) {
	 				document.getElementById("result1").style.display = "block";
				} else if (score_b > score_a && score_b > score_c) {
		 				document.getElementById("result2").style.display = "block";
					} else {
						document.getElementById("result3").style.display = "block";
					}	
		}
	</script>
	<style type="text/css">
		body {
			background-color: #ffffff;
			color: #000000;
		}
		.topic {
			display: none;
		}
		.result {
			display: none;
		}
	</style>
</head>

<body>

<h1>Frag-O-Mat</h1>
<p>
	Dieser Text steht ständig oben drüber.
<p>

<form name="topics">
	<div class="topic" name="topic" id="topic1" style="display: block;">
		<p>
			Dies ist Frage 1.
		</p>
		<div class="answers">
			<input type="radio" name="topic1">Antwort A</input><br>
			<input type="radio" name="topic1">Antwort B</input><br>
			<input type="radio" name="topic1">Antwort C</input><br>
			<input type="button" value="Weiter" onclick='select_topic("topic2")'>
		</div>	
	</div>

	<div class="topic" name="topic" id="topic2">
		<p>
			Dies ist Frage 2.
		</p>
		<div class="answers">
			<input type="radio" name="topic2">Antwort A</input><br>
			<input type="radio" name="topic2">Antwort B</input><br>
			<input type="radio" name="topic2">Antwort C</input><br>
			<input type="button" value="Weiter" onclick='select_topic("topic3")'>
		</div>	
	</div>

	<div class="topic" name="topic" id="topic3">
		<p>
			Dies ist Frage 3.
		</p>
		<div class="answers">
			<input type="radio" name="topic3">Antwort A</input><br>
			<input type="radio" name="topic3">Antwort B</input><br>
			<input type="radio" name="topic3">Antwort C</input><br>
			<input type="button" value="Ergebnis anzeigen" onclick='select_result()'>
		</div>	
	</div>
</form>

<div class="result" name="result" id="result1">
	Dies ist Resultat 1.
</div>

<div class="result" name="result" id="result2">
	Dies ist Resultat 2.
</div>

<div class="result" name="result" id="result3">
	Dies ist Resultat 3.
</div>

<p>
	Dieser Text steht ständig unten drunter.
</p>

</body>
</html>