69 lines
2.2 KiB
HTML
69 lines
2.2 KiB
HTML
<!doctype html>
|
|
<html lang="de">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>Übung 18: Lotto oder der »49-Seiten Würfel«</title>
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet" />
|
|
<link href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" rel="stylesheet" />
|
|
<style>
|
|
*,
|
|
html {
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
.output {
|
|
overflow: hidden;
|
|
}
|
|
|
|
.lotto-ball {
|
|
width: 50px;
|
|
height: 50px;
|
|
border-radius: 50%;
|
|
border: 2px solid #f8f8f8;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
background: #f2f2f2;
|
|
background: radial-gradient(circle, rgba(242, 242, 242, 1) 0%, rgba(130, 130, 130, 1) 93%);
|
|
box-shadow: 0px 3px 10px rgba(0, 0, 0, 0.2);
|
|
}
|
|
.lotto-number {
|
|
font-weight: bolder;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<main>
|
|
<div class="container py-5">
|
|
<div class="alert alert-primary">
|
|
<h2>Übung 18: Lotto oder der »49-Seiten Würfel«</h2>
|
|
<p>
|
|
Für Zufallszahlen von eins bis sechs ist ein Würfel wirklich praktisch — und sinnvoll. Für alle anderen
|
|
Fälle ist ein Zufallsgenerator natürlich unumgänglich und Pflichtprogramm. Zum Beispiel, wenn du Hilfe für
|
|
deine nächsten Lottozahlen benötigst …
|
|
</p>
|
|
<p>
|
|
Schreibe ein Programm, das genau eine Zufallszahl zwischen 1 und 49 ausgibt. Die Grenzwerte 1 und 49 sollen
|
|
dabei inklusive sein und Nachkommastellen sind nicht erwünscht.
|
|
</p>
|
|
</div>
|
|
<div class="output alert alert-secondary my-3">
|
|
<div class="lotto-ball"><span class="lotto-number">00</span></div>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
<script>
|
|
'use strict';
|
|
|
|
const outputEl = document.querySelector('.output');
|
|
const lottoNumberEl = document.querySelector('.lotto-number');
|
|
|
|
// Lottozahl ermitteln (von 1-49)
|
|
const lottoNumber = Math.floor(Math.random() * 49) + 1;
|
|
|
|
lottoNumberEl.textContent = lottoNumber;
|
|
</script>
|
|
</body>
|
|
</html>
|