Open the About Screen چالش 1 از جلسهی 14، آسان
اپ شمارندهی آب دو صفحه دارد: #home و #about. صفحهی #about اول پنهان است. تابع openAbout() را کامل کن: صفحهی #home را با style.display = "none" پنهان کند و #about را با "block" نشان بدهد.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Water Counter</title>
<style>
body { font-family: sans-serif; margin: 0; }
.screen { max-width: 420px; margin: 0 auto; padding: 16px; }
button { min-height: 44px; font-size: 16px; }
#about { display: none; }
</style>
</head>
<body>
<section class="screen" id="home">
<h1>Water Counter</h1>
<p>Count the glasses of water you drink.</p>
<button id="toAbout" onclick="openAbout()">About this app</button>
</section>
<section class="screen" id="about">
<h1>About</h1>
<p>Made by Sara in the app course.</p>
</section>
<script>
function openAbout() {
// hide #home and show #about
}
</script>
</body>
</html>
راهنما و جواب این چالش · برگشت به درس جلسهی 14: چند صفحه · چالش بعدی: There and Back
بیشتر بخوان: جاوااسکریپت چیست؟ از دکمهی وب تا Node.js