MHA / questions.html
arjunakurian's picture
Upload 5 files
31b84bf
<!DOCTYPE html>
<html>
<head>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 20px;
}
h1 {
text-align: center;
}
form {
max-width: 400px;
margin: 0 auto;
padding: 20px;
border: 1px solid #ccc;
border-radius: 5px;
background-color: #f5f5f5;
}
label {
display: block;
margin-bottom: 10px;
}
input[type="text"] {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 3px;
font-size: 16px;
}
input[type="submit"] {
width: 100%;
padding: 10px;
border: none;
border-radius: 3px;
background-color: #4CAF50;
color: #fff;
font-size: 16px;
cursor: pointer;
}
input[type="submit"]:hover {
background-color: #45a049;
}
.next-button {
display: block;
width: 100%;
padding: 10px;
border: none;
border-radius: 3px;
background-color: #0084FF;
color: #fff;
font-size: 16px;
cursor: pointer;
transition: background-color 0.3s;
}
.next-button:hover {
background-color: #006ac1;
}
</style>
<script>
function showNextQuestion(currentQuestion) {
var currentQuestionDiv = document.getElementById(currentQuestion);
currentQuestionDiv.style.display = 'none';
var nextQuestionIndex = parseInt(currentQuestion.replace("question", "")) + 1;
var nextQuestionDiv = document.getElementById("question" + nextQuestionIndex);
nextQuestionDiv.style.display = 'block';
}
</script>
</head>
<body>
<h1>Answer the Questions</h1>
<form action="{{ url_for('show_questions', age=age) }}" method="post">
{% for question in questions %}
<div id="question{{ loop.index }}" {% if loop.index != 1 %}style="display: none;"{% endif %}>
<label for="answer{{ loop.index }}">{{ question }}</label>
<input type="text" name="answer{{ loop.index }}" required>
<br>
{% if loop.index != questions|length %}
<button type="button" class="next-button" onclick="showNextQuestion('question{{ loop.index }}')">Next</button>
{% else %}
<input type="submit" value="Submit">
{% endif %}
</div>
{% endfor %}
</form>
</body>
</html>