Skip to main content

Membership is free!

Roll Four Six-Sided Dice

-
-
-
-

The code:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Dice Roll Simulation</title>
    <style>
        .dice-container {
            margin-top: 20px;
        }
        .dice {
            font-size: 24px;
            font-weight: bold;
            padding: 10px;
            border: 1px solid #000;
            display: inline-block;
            margin: 5px;
            text-align: center;
            width: 50px;
            height: 50px;
            line-height: 50px;
            vertical-align: middle;
        }
    </style>
</head>
<body>

<h2>Roll Four Six-Sided Dice</h2>

<button onclick="rollDice()">Roll Dice</button>

<div class="dice-container">
    <div id="dice1" class="dice">-</div>
    <div id="dice2" class="dice">-</div>
    <div id="dice3" class="dice">-</div>
    <div id="dice4" class="dice">-</div>
</div>

<script>
function rollDice() {
    // Generate a random number between 1 and 6 for each dice roll
    var roll1 = Math.floor(Math.random() * 6) + 1;
    var roll2 = Math.floor(Math.random() * 6) + 1;
    var roll3 = Math.floor(Math.random() * 6) + 1;
    var roll4 = Math.floor(Math.random() * 6) + 1;

    // Display the results
    document.getElementById('dice1').textContent = roll1;
    document.getElementById('dice2').textContent = roll2;
    document.getElementById('dice3').textContent = roll3;
    document.getElementById('dice4').textContent = roll4;
}
</script>

</body>
</html>
Cron Job Starts