Wie kann ich etwas von JavaScript nach HTML zurückgeben?
Posted: 17 Jan 2025, 08:23
Code: Select all
Dice Roller
Dice Roller
Can't decide on what to eat? Or what to do? Our dice roller is perfect for this.
Roll
var x = rollDice(1, 6);
output.innerHTML = x;
Code: Select all
function rollDice(a, b) {
dice = Math.floor(Math.random() * (b + 1)) + a
return dice
}
Code: Select all
body {
background-color: orange;
font-family:system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
text-align: center;
font-size: 150%;
}
.roll-button {
height: 40px;
width: 80px;
font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
font-size: large;
}