title: how to create button displays image file
body: <p>I'm working on a webpage and I'm still learning HTML/CSS/Javascript. I'm trying to create a button such that it displays a random image file from my computer or database, but I'm not sure how to go about writing it. Here's my code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function display() {
    var popup = document.getElementById("img").src = "img_1.jpg";
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;button class="popup" onclick="display()"&gt;ITERATION.
    &lt;span class="popupimg" id="img"&gt;img_1.jpg&lt;/span&gt;
  &lt;/button&gt;</code></pre>
  </div>
  </div>
  </p>