<!DOCTYPE html>
<html>
<head>
  <style>

    body {
      font-family: Arial, sans-serif;
      background: aliceblue;
      text-align: center;
      padding: 30px;
    }

    h1 {
      color: navy;
    }

    input {
      padding: 8px;
      margin: 5px;
      border: 2px solid navy;
      border-radius: 6px;
      width: 220px;
    }

    button {
      background: navy;
      color: white;
      padding: 10px 25px;
      border: none;
      border-radius: 20px;
      cursor: pointer;
    }

    #timer {
      color: grey;
    }

  </style>
</head>
<body>

  <h1>Lucky Draw</h1>
  <p>Enter your name and guess a number to win!</p>

  <input type="text" id="name" placeholder="Your name" required><br>
  <p id="msg-name"></p>

  <input type="number" id="guess" placeholder="Guess a number (1 to 5)" min="1" max="5" required><br>
  <p id="msg-guess"></p>

  <button onclick="checkForm()">Try My Luck!</button>
  <p id="result"></p>
  <p id="timer"></p>

  <script>


      if (ok == true) {
        var lucky = Math.floor(Math.random() * 5) + 1;
        if (guess == lucky) {
          document.getElementById("result").textContent = "You win, " + name + "! The lucky number was " + lucky + "!";
          document.getElementById("result").style.color = "green";
        } else {
          document.getElementById("result").textContent = "So close, " + name + "! The lucky number was " + lucky + ". Try again!";
          document.getElementById("result").style.color = "navy";
        }
      }
    }

  </script>
</body>
</html>

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: