Spaces:
Runtime error
Runtime error
{% extends 'base.html' %} | |
{% block content %} | |
<h1>ํด์ฆ ์์ฑ ๊ฒฐ๊ณผ</h1> | |
{% if quizzes %} | |
<ul> | |
{% for quiz in quizzes %} | |
<li> | |
<h2>๋ฌธ์ ์ฃผ์ธ: {{ quiz[3] }}</h2> <!-- ์ด๋ฆ ๋ถ๋ถ --> | |
<h3>์ง๋ฌธ: {{ quiz[0] }}</h3> <!-- ์ง๋ฌธ ๋ถ๋ถ --> | |
<ul> | |
{% for option in quiz[1] %} <!-- 4์ง์ ๋ค ๋ณด๊ธฐ --> | |
<li>{{ option }}</li> | |
{% endfor %} | |
</ul> | |
<button onclick="showAnswer('{{ loop.index0 }}')">์ ๋ต ๋ณด๊ธฐ</button> | |
<p id="answer-{{ loop.index0 }}" style="display: none;">์ ๋ต: {{ quiz[2] }}</p> <!-- ์ ๋ต --> | |
</li> | |
{% endfor %} | |
</ul> | |
{% else %} | |
<p>ํด์ฆ๊ฐ ์์ต๋๋ค. ๋ค์ ์๋ํด ์ฃผ์ธ์.</p> | |
{% endif %} | |
<script> | |
let currentQuizIndex = 0; | |
function showAnswer(index) { | |
const answer = document.getElementById(`answer-${index}`); | |
if (answer.style.display === "none") { | |
answer.style.display = "block"; | |
} else { | |
answer.style.display = "none"; | |
} | |
currentQuizIndex++; | |
// ํด์ฆ๋ฅผ ๋ชจ๋ ํ๊ณ ๋๋ฉด ๋ง๋ฌด๋ฆฌ ํ์ด์ง๋ก ์ด๋ | |
if (currentQuizIndex === { length }) { | |
setTimeout(() => { | |
window.location.href = "{{ url_for('quiz.finish') }}"; | |
}, 3000); // 3์ด ํ ์๋ ์ด๋ | |
} | |
} | |
</script> | |
{% endblock %} |