Herzlich willkommen zum SELF-Treffen 2026
vom 24.04. – 26.04.2026
in Halle (Saale)
Beispiel:JS-math.random-2.html
<!DOCTYPE html> <html lang="de">
<head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" media="screen" href="./Beispiel:Grundlayout.css">
<title>math.random</title>
<style>
</style> <script> 'use strict'; document.addEventListener("DOMContentLoaded", function () {
document.querySelector('#submit').addEventListener("click", ausgabeZufallszahl);
const min = 1, max = 10;
function rand (min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; }
function ausgabeZufallszahl () { document.querySelector('output').innerText = rand(min, max); } }); </script> </head>
<body>
math.random
(Helferfunktion)
<button type="button" id="submit">Zufallszahl!</button>
<output>Ergebnisausgabe</output>
</body> </html>