Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
KapuluruBhuvaneswariVspdbct committed Nov 9, 2024
1 parent 67beb65 commit de12ad3
Show file tree
Hide file tree
Showing 4 changed files with 357 additions and 1 deletion.
158 changes: 158 additions & 0 deletions assets/html/exp.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
<!DOCTYPE html>
<html lang="en">
<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>
<style>
body {
font-family: Arial, sans-serif;
background-color: #ffd2d3; /* Changed to pink color */
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}

.quiz-container {
background: white;
padding: 20px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
width: 300px;
text-align: center;
}

button {
padding: 10px 20px;
margin-top: 20px;
cursor: pointer;
background-color: #b00000;
color: white;
border: none;
border-radius: 5px;
display: block; /* Make buttons block elements for vertical display */
width: 100%; /* Make buttons full width */
}

button:hover {
background-color: #0056b3;
}

h4 {
margin: 10px 0;
}

.option {
margin: 5px 0; /* Space between options */
}

.solution {
margin-top: 10px;
text-align: left;
}

</style>
</head>
<body>

<div class="quiz-container">
<h1>The Story of Experiments 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>
</div>

<script>
const quizData = [
{
question: "What is the full title of the autobiography written by Mahatma Gandhi?",
options: ["The Story of Experiments with Truth", "Truth and Non-Violence", "My Experiments with Truth", "Gandhi's Truth Journey"],
answer: "The Story of Experiments with Truth"
},
{
question: "Where was Mahatma Gandhi born?",
options: ["Pune", "Delhi", "Porbandar", "Mumbai"],
answer: "Porbandar"
},
{
question: "What was the name of the movement led by Gandhi to end British rule in India?",
options: ["Non-Cooperation Movement", "Salt March", "Quit India Movement", "Civil Disobedience Movement"],
answer: "Non-Cooperation Movement"
},
{
question: "What did Gandhi do to protest against the British Salt Tax?",
options: ["Fast until death", "Salt March", "Non-violent protests", "Boycott British goods"],
answer: "Salt March"
},
{
question: "What principle did Gandhi adopt for his political and social work?",
options: ["Satya (Truth)", "Ahimsa (Non-violence)", "Swaraj (Self-rule)", "All of the above"],
answer: "All of the above"
}
];

let currentQuestionIndex = 0;
let score = 0;

function loadQuestion() {
const questionElement = document.getElementById('quiz-questions');
questionElement.innerHTML = '';

const currentQuestion = quizData[currentQuestionIndex];
const questionText = document.createElement('h4');
questionText.innerText = currentQuestion.question;
questionElement.appendChild(questionText);

currentQuestion.options.forEach(option => {
const optionButton = document.createElement('button');
optionButton.classList.add('option');
optionButton.innerText = option;
optionButton.onclick = () => selectAnswer(option);
questionElement.appendChild(optionButton);
});
}

function selectAnswer(selectedOption) {
const currentQuestion = quizData[currentQuestionIndex];
if (selectedOption === currentQuestion.answer) {
score++;
}
currentQuestionIndex++;

if (currentQuestionIndex < quizData.length) {
loadQuestion();
} else {
showResult();
}
}

function showResult() {
const quizContainer = document.querySelector('.quiz-container');
quizContainer.innerHTML = `<h2>Your Score: ${score}/${quizData.length}</h2>`;

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

function submitQuiz() {
if (currentQuestionIndex < quizData.length) {
alert("Please answer all questions before submitting!");
} else {
showResult();
}
}

// Load the first question when the page is ready
document.addEventListener('DOMContentLoaded', loadQuestion);
</script>

</body>
</html>
158 changes: 158 additions & 0 deletions assets/html/home.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Home and the World Quiz</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #ffd2d3; /* Changed to pink color */
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}

.quiz-container {
background: white;
padding: 20px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
width: 300px;
text-align: center;
}

button {
padding: 10px 20px;
margin-top: 20px;
cursor: pointer;
background-color: #b00000;
color: white;
border: none;
border-radius: 5px;
display: block; /* Make buttons block elements for vertical display */
width: 100%; /* Make buttons full width */
}

button:hover {
background-color: #0056b3;
}

h4 {
margin: 10px 0;
}

.option {
margin: 5px 0; /* Space between options */
}

.solution {
margin-top: 10px;
text-align: left;
}

</style>
</head>
<body>

<div class="quiz-container">
<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>
</div>

<script>
const quizData = [
{
question: "Who is the author of the book 'Home and the World'?",
options: ["Rabindranath Tagore", "Mahatma Gandhi", "Sarojini Naidu", "Jawaharlal Nehru"],
answer: "Rabindranath Tagore"
},
{
question: "In 'Home and the World', what is the central theme of the novel?",
options: ["Independence Movement", "Social Reforms", "Nationalism and Modernity", "Cultural Heritage"],
answer: "Nationalism and Modernity"
},
{
question: "Which character in 'Home and the World' is a symbol of traditional Indian values?",
options: ["Bimala", "Nikhil", "Sandip", "Aunt"],
answer: "Bimala"
},
{
question: "What is the role of Nikhil in 'Home and the World'?",
options: ["A nationalist leader", "Bimala's husband", "A freedom fighter", "A spiritual guide"],
answer: "Bimala's husband"
},
{
question: "In the novel, which character represents the modern, nationalist ideology?",
options: ["Bimala", "Sandip", "Nikhil", "Aunt"],
answer: "Sandip"
}
];

let currentQuestionIndex = 0;
let score = 0;

function loadQuestion() {
const questionElement = document.getElementById('quiz-questions');
questionElement.innerHTML = '';

const currentQuestion = quizData[currentQuestionIndex];
const questionText = document.createElement('h4');
questionText.innerText = currentQuestion.question;
questionElement.appendChild(questionText);

currentQuestion.options.forEach(option => {
const optionButton = document.createElement('button');
optionButton.classList.add('option');
optionButton.innerText = option;
optionButton.onclick = () => selectAnswer(option);
questionElement.appendChild(optionButton);
});
}

function selectAnswer(selectedOption) {
const currentQuestion = quizData[currentQuestionIndex];
if (selectedOption === currentQuestion.answer) {
score++;
}
currentQuestionIndex++;

if (currentQuestionIndex < quizData.length) {
loadQuestion();
} else {
showResult();
}
}

function showResult() {
const quizContainer = document.querySelector('.quiz-container');
quizContainer.innerHTML = `<h2>Your Score: ${score}/${quizData.length}</h2>`;

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

function submitQuiz() {
if (currentQuestionIndex < quizData.length) {
alert("Please answer all questions before submitting!");
} else {
showResult();
}
}

// Load the first question when the page is ready
document.addEventListener('DOMContentLoaded', loadQuestion);
</script>

</body>
</html>
40 changes: 40 additions & 0 deletions assets/html/quizzes.html
Original file line number Diff line number Diff line change
Expand Up @@ -1332,6 +1332,46 @@ <h4>Quiz Questions:</h4>
</div>
</div>



<div class="card" onclick="this.classList.toggle('flip')">
<div class="card-inner">
<div class="card-front home">
<h1>Home and the World</h1>
</div>
<div class="card-back">
<button onclick="window.location.href='home.html';">Start Quiz</button>
<div class="quiz" style="display: none;">
<h4>Quiz Questions:</h4>
<div id="quiz-questions">
<!-- Questions will be inserted here -->
</div>
<button onclick="submitQuiz("#home.html")">Submit</button>
<div id="quiz-result" style="display: none;"></div>
</div>
</div>
</div>
</div>

<div class="card" onclick="this.classList.toggle('flip')">
<div class="card-inner">
<div class="card-front exp">
<h1>The Story Of My Experiments With Truth</h1>
</div>
<div class="card-back">
<button onclick="window.location.href='exp.html';">Start Quiz</button>
<div class="quiz" style="display: none;">
<h4>Quiz Questions:</h4>
<div id="quiz-questions">
<!-- Questions will be inserted here -->
</div>
<button onclick="submitQuiz("#exp.html")">Submit</button>
<div id="quiz-result" style="display: none;"></div>
</div>
</div>
</div>
</div>

<div class="card" onclick="this.classList.toggle('flip')">
<div class="card-inner">
<div class="card-front un">
Expand Down
2 changes: 1 addition & 1 deletion assets/html/top10.html
Original file line number Diff line number Diff line change
Expand Up @@ -1328,7 +1328,7 @@ <h3>Author: Mahatma Gandhi</h3>
<h3>Author: Rabindranath Tagore</h3>
<p><strong>Summary:</strong> A political and philosophical exploration of love and freedom against the backdrop of India's independence struggle.</p>
<p><strong>Time Period:</strong> 1916 - Present</p>

</div></div></div></div>
<!-- Card Container -->


Expand Down

0 comments on commit de12ad3

Please sign in to comment.