Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

solved #4875 and #4881 #4882

Merged
merged 1 commit into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 36 additions & 3 deletions assets/html/exp.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>The Story of Experiments with Truth Quiz</title>
<title>The story of my expirements with truth Quiz</title>
<style>
body {
font-family: Arial, sans-serif;
Expand Down Expand Up @@ -58,13 +58,14 @@
<body>

<div class="quiz-container">
<h1>The Story of Experiments with Truth Quiz</h1>
<h1>The story of my expirements with truth Quiz</h1>
<div id="quiz-questions">
<!-- Questions will be inserted here -->
</div>
<button id="submit-button" onclick="submitQuiz()">Submit</button>
<div id="quiz-result" style="display: none;"></div>
<button id="home-button" style="display: none;" onclick="window.location.href='quizzes.html';">Return to Quizzes</button>
<button id="home-button" style="display: none;" onclick="window.location.href='index.html';">Return to Home</button>
<button id="solutions-button" style="display: none;" onclick="showSolutions()">See Solutions</button>
</div>

<script>
Expand Down Expand Up @@ -140,6 +141,38 @@ <h1>The Story of Experiments with Truth Quiz</h1>
homeButton.onclick = () => window.location.href = 'quizzes.html';
homeButton.innerText = 'Return to Quizzes';
quizContainer.appendChild(homeButton);

// Create the see solutions button
const solutionsButton = document.createElement('button');
solutionsButton.onclick = showSolutions;
solutionsButton.innerText = 'See Solutions';
quizContainer.appendChild(solutionsButton);
}

function showSolutions() {
const quizContainer = document.querySelector('.quiz-container');
quizContainer.innerHTML = '<h2>Quiz Solutions</h2>';

quizData.forEach((question, index) => {
const solutionElement = document.createElement('div');
solutionElement.classList.add('solution');

const questionText = document.createElement('h4');
questionText.innerText = `${index + 1}. ${question.question}`;
solutionElement.appendChild(questionText);

const correctAnswer = document.createElement('p');
correctAnswer.innerText = `Correct Answer: ${question.answer}`;
solutionElement.appendChild(correctAnswer);

quizContainer.appendChild(solutionElement);
});

// Add the return to home button again
const homeButton = document.createElement('button');
homeButton.onclick = () => window.location.href = 'quizzes.html';
homeButton.innerText = 'Return to Home';
quizContainer.appendChild(homeButton);
}

function submitQuiz() {
Expand Down
39 changes: 36 additions & 3 deletions assets/html/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Home and the World Quiz</title>
<title>Home and the world Quiz</title>
<style>
body {
font-family: Arial, sans-serif;
Expand Down Expand Up @@ -58,13 +58,14 @@
<body>

<div class="quiz-container">
<h1>Home and the World Quiz</h1>
<h1>Home and the world Quiz</h1>
<div id="quiz-questions">
<!-- Questions will be inserted here -->
</div>
<button id="submit-button" onclick="submitQuiz()">Submit</button>
<div id="quiz-result" style="display: none;"></div>
<button id="home-button" style="display: none;" onclick="window.location.href='quizzes.html';">Return to Quizzes</button>
<button id="home-button" style="display: none;" onclick="window.location.href='index.html';">Return to Home</button>
<button id="solutions-button" style="display: none;" onclick="showSolutions()">See Solutions</button>
</div>

<script>
Expand Down Expand Up @@ -140,6 +141,38 @@ <h1>Home and the World Quiz</h1>
homeButton.onclick = () => window.location.href = 'quizzes.html';
homeButton.innerText = 'Return to Quizzes';
quizContainer.appendChild(homeButton);

// Create the see solutions button
const solutionsButton = document.createElement('button');
solutionsButton.onclick = showSolutions;
solutionsButton.innerText = 'See Solutions';
quizContainer.appendChild(solutionsButton);
}

function showSolutions() {
const quizContainer = document.querySelector('.quiz-container');
quizContainer.innerHTML = '<h2>Quiz Solutions</h2>';

quizData.forEach((question, index) => {
const solutionElement = document.createElement('div');
solutionElement.classList.add('solution');

const questionText = document.createElement('h4');
questionText.innerText = `${index + 1}. ${question.question}`;
solutionElement.appendChild(questionText);

const correctAnswer = document.createElement('p');
correctAnswer.innerText = `Correct Answer: ${question.answer}`;
solutionElement.appendChild(correctAnswer);

quizContainer.appendChild(solutionElement);
});

// Add the return to home button again
const homeButton = document.createElement('button');
homeButton.onclick = () => window.location.href = 'quizzes.html';
homeButton.innerText = 'Return to Home';
quizContainer.appendChild(homeButton);
}

function submitQuiz() {
Expand Down
Loading