I'm working on a slot machine game where i take 3 random numbers and assign them to different images.
However, I can't get my images to display when you click the button to play the game.
I have the stock images there but when you click SPIN it should replace them with new images based on random numbers.
How can I get the new images to display?.
My code:
    <html>
    <head>
      <title>Slots</title>
      <link href="../style.css" type="text/css" rel="stylesheet">
      <script type="text/javascript" src="random.js">
        function spinslots() {
          var lemon = document.getElementById('lemon.jpg');
          var donut = document.getElementById('donut.jpg');
          var cherry = document.getElementById('cherry.jpg');
          var bar = document.getElementById('bar.jpg');
          var random_1;
              random_1= Math.floor((Math.random()*4 )+ 1);
          var random_2;
              random_2 = Math.floor((Math.random()*4 )+ 1);
          var random_3;
              random_3 = Math.floor((Math.random()*4 )+ 1);
          if (random_1 == 1) {
            document.getElementById("slot_1").src = "lemon.jpg";
          }
          if (random_1 == 2) {
            document.getElementById("slot_1").src = "donut.jpg";
          }
          if (random_1 == 3) {
            document.getElementById("slot_1").src = "cherry.jpg";
          }
          if (random_1 == 4) {
            document.getElementById("slot_1").src = "bar.jpg";
          }
          if (random_2 == 1) {
            document.getElementById("slot_2").src = "lemon.jpg";
          }
          if (random_2 == 2) {
            document.getElementById("slot_2").src = "donut.jpg";
          }
          if (random_2 == 3) {
            document.getElementById("slot_2").src = "cherry.jpg";
          }
          if (random_2 == 4) {
            document.getElementById("slot_2").src = "bar.jpg";
          }
          if (random_3 == 1) {
            document.getElementById("slot_3").src = "lemon.jpg";
          }
          if (random_3 == 2) {
            document.getElementById("slot_3").src = "donut.jpg";
          }
          if (random_3 == 3) {
            document.getElementById("slot_3").src = "cherry.jpg";
          }
          if (random_3 == 4) {
            document.getElementById("slot_3").src = "bar.jpg";
          }
          if (random_1 == random_2 == random_3) {
            alert("Congradulations, you won!");
          }
        }     
      </script>
    </head>
    <body>
      <h1>Test your luck! Click the SPIN button</h1>
      <p><button value="Spin" onclick="spinslots();"> SPIN </button></p>
      <p>
        <div class="SlotDiv" id="div_1"><image id="slot_1" src="images/lemon.jpg"></image></div>
        <div class="SlotDiv" id="div_2"><image id="slot_2" src="images/cherry.jpg"></image></div>
        <div class="SlotDiv" id="div_3"><image id="slot_3" src="images/bar.jpg"></image></div>
      </p>
      <p>Credits: <div class="OutputBox" type="numeric" id="Credits" size="10">20</div></p>
    
  </body>
</html> 
    