You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

91 lines
3.1 KiB

<!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="/hungary/language/vocabulary/vocabulary.html">Vocabulary</a></button>
<button><a href="/hungary/language/homework/homework.html">Homework</a></button>
<button><a href="/hungary/hungary.html">Hungary</a></button>
<button><a href="/">Home</a></button>
<div id="meaning"></div>
<script>
// Simulating a database of words and meanings
const wordDatabase = [
{ word: "day", meaning: "nap" },
{ word: "morning", meaning: "reggel" },
{ word: "to wake up/get up", meaning: "felkelni" },
{ word: "and", meaning: "és" },
{ word: "into", meaning: "-ba/ne" },
{ word: "kitchen", meaning: "konyha" },
{ word: "also", meaning: "is" },
{ word: "sugar", meaning: "cukor" },
{ word: "breakfast", meaning: "reggeli" },
{ word: "language", meaning: "nyelv" },
{ word: "bathroom", meaning: "fürdőszoba" },
{ word: "brush hair", meaning: "megfésülködni" },
{ word: "brush teeth", meaning: "fogat mosni" },
{ word: "university", meaning: "egyetem" },
];
// 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>