|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<title>Word Meaning Display</title>
|
|
|
|
<style>
|
|
|
|
body {
|
|
|
|
font-family: Arial, sans-serif;
|
|
|
|
margin: 40px;
|
|
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
#wordContainer {
|
|
|
|
font-size: 24px;
|
|
|
|
margin-bottom: 20px;
|
|
|
|
}
|
|
|
|
#meaning {
|
|
|
|
font-size: 20px;
|
|
|
|
color: #333;
|
|
|
|
margin-top: 20px;
|
|
|
|
display: none; /* Hide meaning initially */
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<h1>Word Meaning Display</h1>
|
|
|
|
|
|
|
|
<div id="wordContainer">
|
|
|
|
<span id="word"></span>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<button onclick="showMeaning()">Show Meaning</button>
|
|
|
|
<button onclick="getNextWord()">Next</button>
|
|
|
|
<p></p>
|
|
|
|
<button><a href="/japan/language/vocabulary/vocabulary.html">Vocabulary</a></button>
|
|
|
|
<button><a href="/japan/language/language/homework/homework.html">Homework</a></button>
|
|
|
|
<button><a href="/japan/japan.html">Japan</a></button>
|
|
|
|
<button><a href="/">Home</a></button>
|
|
|
|
|
|
|
|
<div id="meaning"></div>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
// Simulating a database of words and meanings
|
|
|
|
const wordDatabase = [
|
|
|
|
{ word: "", meaning: "" },
|
|
|
|
{ word: "", meaning: "" },
|
|
|
|
{ word: "", meaning: "" },
|
|
|
|
{ word: "", meaning: "" },
|
|
|
|
{ word: "", meaning: "" },
|
|
|
|
{ word: "", meaning: "" },
|
|
|
|
{ word: "", meaning: "" },
|
|
|
|
{ word: "", meaning: "" },
|
|
|
|
{ word: "", meaning: "" },
|
|
|
|
{ word: "", meaning: "" },
|
|
|
|
{ word: "", meaning: "" },
|
|
|
|
{ word: "", meaning: "" },
|
|
|
|
{ word: "", meaning: "" },
|
|
|
|
{ word: "", meaning: "" },
|
|
|
|
{ word: "", meaning: "" },
|
|
|
|
{ word: "", meaning: "" },
|
|
|
|
{ word: "", meaning: "" },
|
|
|
|
{ word: "", meaning: "" },
|
|
|
|
{ word: "", meaning: "" },
|
|
|
|
{ word: "", meaning: "" },
|
|
|
|
{ word: "", meaning: "" },
|
|
|
|
{ word: "", meaning: "" },
|
|
|
|
{ word: "", meaning: "" },
|
|
|
|
{ word: "", meaning: "" },
|
|
|
|
];
|
|
|
|
|
|
|
|
// Function to pick a random word from the database
|
|
|
|
function getRandomWord() {
|
|
|
|
const randomIndex = Math.floor(Math.random() * wordDatabase.length);
|
|
|
|
return wordDatabase[randomIndex];
|
|
|
|
}
|
|
|
|
|
|
|
|
// Display the word on the page
|
|
|
|
var currentWord = getRandomWord();
|
|
|
|
document.getElementById("word").textContent = currentWord.word;
|
|
|
|
|
|
|
|
// Show the meaning when the button is clicked
|
|
|
|
function showMeaning() {
|
|
|
|
console.log("Running the showMeaning function");
|
|
|
|
document.getElementById("meaning").textContent = currentWord.meaning;
|
|
|
|
document.getElementById("meaning").style.display = "block"; // Display the meaning
|
|
|
|
}
|
|
|
|
|
|
|
|
// get the next word
|
|
|
|
function getNextWord() {
|
|
|
|
console.log("Running the getRandomWord function");
|
|
|
|
currentWord=getRandomWord();
|
|
|
|
document.getElementById("word").textContent = currentWord.word;
|
|
|
|
document.getElementById("meaning").style.display = "none"; // Display the meaning
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|