This commit is contained in:
2019-07-11 14:34:21 +02:00
parent 10572f7ab6
commit cfb38e8972
2 changed files with 118 additions and 15 deletions

View File

@@ -8,15 +8,9 @@
</style> </style>
<link rel="stylesheet" href="style.css">
</head> </head>
<body> <body>
<!--
//button
//<input type="number" id="n" min="1" max="20">
//<button id="get-questions" onclick="listener()"></button>
-->
<div id="screen1"> <div id="screen1">
Anzahl fragen: Anzahl fragen:
@@ -54,6 +48,10 @@
var answer1 = document.getElementById("answer1"); var answer1 = document.getElementById("answer1");
var answer2 = document.getElementById("answer2"); var answer2 = document.getElementById("answer2");
//buttons zuweisen
answer0.addEventListener('click', answerQuestion);
answer1.addEventListener('click', answerQuestion);
answer2.addEventListener('click', answerQuestion);
//Start game //Start game
function listener() { function listener() {
@@ -68,7 +66,6 @@ function listener() {
var right = document.getElementById('right'); var right = document.getElementById('right');
var total = document.getElementById('total'); var total = document.getElementById('total');
} }
//Start a new game //Start a new game
@@ -80,7 +77,6 @@ function newGame() {
function showQuestion() { function showQuestion() {
var question = questions[currentQuestion]; var question = questions[currentQuestion];
questionDiv.innerHTML = question.question; questionDiv.innerHTML = question.question;
answer0.innerHTML = question.answers[0]; answer0.innerHTML = question.answers[0];
answer1.innerHTML = question.answers[1]; answer1.innerHTML = question.answers[1];
@@ -115,7 +111,6 @@ function answerQuestion(event) {
}, 2000); }, 2000);
} }
function showResult() { function showResult() {
screen2.style.display = "none"; screen2.style.display = "none";
@@ -125,11 +120,6 @@ function showResult() {
total.innerHTML = questions.length; total.innerHTML = questions.length;
} }
//buttons zuweisen
answer0.addEventListener('click', answerQuestion);
answer1.addEventListener('click', answerQuestion);
answer2.addEventListener('click', answerQuestion);
function getQuestions() { function getQuestions() {
var request = new XMLHttpRequest(); var request = new XMLHttpRequest();

113
uebung10/style.css Normal file
View File

@@ -0,0 +1,113 @@
body {
font-family: sans-serif;
color: #000;
text-align: center;
transition: background-color 250ms linear;
background-color: #fff;
}
a {
color: black;
}
.post, input, textarea {
max-width: 30em;
width: 100%;
padding: 1em;
margin: 1em auto;
background-color: #fff;
border: 1px solid black;
color: black;
text-align: justify;
box-sizing: border-box;
border-radius: 0.5em;
}
form {
max-width: 30em;
width: 100%;
margin: 0 auto;
}
input, textarea {
max-width: 100%;
box-sizing: border-box;
}
.post h1 {
margin: 0;
}
.post .meta {
font-size: 75%;
font-style: italic;
border-top: 1px dotted black;
border-bottom: 1px dotted black;
padding: 0.25em;
}
.post a {
color: red;
}
.post p {
margin: 0 0 0.5em;
}
.question, .answer {
max-width: 30em;
width: 100%;
margin: 1em auto;
background-color: #fff;
color: black;
text-align: justify;
box-sizing: border-box;
display: block;
}
.question {
/*background-color: #2e6da4;
color: white;*/
font-weight: bold;
}
.answer {
background-color: #eee;
cursor: pointer;
padding: 1em;
}
.answer:hover {
background-color: #ccc;
}
body {
font-family: sans-serif;
text-align: center;
}
table {
border-collapse: collapse;
max-width: 100%;
margin: 0 auto;
}
tr, td {
border: 1px solid black;
padding: 3px;
}
.form-box {
display: flex;
flex-direction: row;
}
.form-solution {
flex-grow: 0;
width: 0;
margin-right: 0.5em
}
.form-answer {
flex-grow: 1
}