title: Loop images next to each other from an array( horizontal) Javascript DOM
body: <p>I´m playing with DOM and JS.
  Can someone show me an hint how to get the images NEXT TO EACH OTHER, not  overwrite..
  like: randomnumberimage1 randomnumberimage2 randomnumberimage3 etc...</p>
  
  <pre><code> &lt;html&gt;
  &lt;head&gt;
      &lt;meta charset="utf-8" /&gt;
      &lt;title&gt;Söka Tärning&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;p&gt;Klicka för att fylla på arrayen med slumptal.&lt;/p&gt;
  
      &lt;button onclick="slumpatal()"&gt;Slumpa&lt;/button&gt;
      &lt;button onclick="sortering()"&gt;Sortera Högsta---&gt;Lägsta&lt;/button&gt;
      &lt;button onclick="hittanummer(3)"&gt;Hitta 3:or&lt;/button&gt;
  
      &lt;p id="allatal"&gt;&lt;/p&gt;
      &lt;p id="vinst"&gt;&lt;/p&gt;
      &lt;p id="sokt_tal"&gt;&lt;/p&gt;
  
      &lt;img id="tarningsbilder" src="bild1.png" alt="tärning" /&gt;
      &lt;img id="helavektorn" src="bild1.png" alt="tärning" /&gt;
       &lt;script&gt;
           var alla_tal_i_vektorn = [];
           var antal_sökta_tal = 0;
  
           function slumpatal() {
               document.getElementById("vinst").innerHTML = "";
  
               slumptal = Math.floor(Math.random() * 3) + 1;
               alla_tal_i_vektorn.push(slumptal);
  
  
  
               for (var i = 0; i &lt; alla_tal_i_vektorn.length; i++) {
                   document.getElementById("tarningsbilder").src = "bild" + alla_tal_i_vektorn[i] + ".png";
  
               }
  
               document.getElementById("allatal").innerHTML = alla_tal_i_vektorn;
               document.getElementById("tarningsbilder").src = "bild" + slumptal + ".png";
               if (slumptal == 3)
                   document.getElementById("vinst").innerHTML = "en trea yieppie!!";
           }
  
           function sortering() {
               alla_tal_i_vektorn.sort(function (a, b) { return b - a });
               document.getElementById("vinst").innerHTML = alla_tal_i_vektorn;
           }
  
           function hittanummer(sökt_tal) {
               antal_sökta_tal = 0;
               for (var i = 0; i &lt; alla_tal_i_vektorn.length; i++) {
                   if (alla_tal_i_vektorn[i] == sökt_tal)
                       antal_sökta_tal += 1;
               }
               document.getElementById("sokt_tal").innerHTML = "det fanns " + antal_sökta_tal + "st treor!";
           }
      &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Thanks in advance for all kind of help</p>
  
  <p>Regards
  Tha Pig</p>
  
  <p>Find a snice solution by myself..! Her´s the code:</p>
  
  <blockquote>
    <p> 
        
        Söka och sortera tärning   <p>Klicka för att fylla på arrayen med slumptal.</p></p>
  
  <pre><code>&lt;button onclick="myFunction()"&gt;Slumpa&lt;/button&gt;
  &lt;button onclick="sortering()"&gt;Sortera Högsta--&gt;Lägsta&lt;/button&gt;
  &lt;button onclick="findById(3)"&gt;Hitta 3:or&lt;/button&gt;
  
  &lt;p id="demo"&gt;&lt;/p&gt;
  &lt;p id="vinst"&gt;&lt;/p&gt;
  &lt;p id="sokt_tal"&gt;&lt;/p&gt;
  
  
  
  &lt;script&gt;
      var all_numbers = [];
      **var alla_bilder = [];**
      var nums = 0;
  
      function myFunction() {
          document.getElementById("vinst").innerHTML = "";
  
          slumptal = Math.floor(Math.random() * 3) + 1;
          all_numbers.push(slumptal);
          ***alla_bilder.push("&lt;img src=bild" + slumptal + ".png\&gt;");***
  
          **document.getElementById("demo").innerHTML = alla_bilder;**
          document.getElementById("demo").src = "bild" + slumptal + ".png";
  
  
  
          if (slumptal == 3)
              document.getElementById("vinst").innerHTML = "en trea yieppie!!";
      }
  
      function sortering() {
          all_numbers.sort(function (a, b) { return b - a });
          document.getElementById("vinst").innerHTML = all_numbers;
      }
  
      function findById(num) {
          nums = 0;
          for (var i = 0; i &lt; all_numbers.length; i++) {
              if (all_numbers[i] == num)
                  nums += 1;
          }
          document.getElementById("sokt_tal").innerHTML = "det fanns " + nums + "st treor!";
      }
  &lt;/script&gt; &lt;/body&gt; &lt;/html&gt;
  </code></pre>
  </blockquote>
  
  <p>Thanks
  Tha Pig</p>