Würfeln
<!DOCTYPE html><html><body>
<h1>Würfeln</h1>
<p>Die Schaltfläche sartet ein JavaScript-Programm und meldet die Augenzahl.</p><form> <input type="button" value="Würfle!" onclick="msg()"></form><p id="Text"></p>
<script>function msg() { let Augenzahl=Math.floor(Math.random()*6)+1; //alert(Augenzahl); document.getElementById("Text").innerHTML = "Augenzahl: "+ Augenzahl;}</script>
</body></html>
<h1>Würfeln</h1>
<p>Die Schaltfläche sartet ein JavaScript-Programm und meldet die Augenzahl.</p><form> <input type="button" value="Würfle!" onclick="msg()"></form><p id="Text"></p>
<script>function msg() { let Augenzahl=Math.floor(Math.random()*6)+1; //alert(Augenzahl); document.getElementById("Text").innerHTML = "Augenzahl: "+ Augenzahl;}</script>
</body></html>