I want to create an html popup that take variable input

I have instructions with pictures that get displayed when a user clicks a link.
I know how to create a “static” popup – one that has a static image. I’d like to create a single parameterized popup that would display the image I tell it to.

I want to do something like this :

I am writing some instructions about how to use the <a href="javascript:alert('dishwasher.jpg');">dishwasher </a>
and the <a href="javascript:alert('washing machine.jpg');">washing machine</a>, etc.
<script>
function alert(image) {
  var popup = document.getElementById("myPopup");
<!--   somehow tell the popup to show image -->
  popup.classList.toggle("show");

}</script>
<div class="popup" onclick="myFunction()">Click me!
  <span class="popuptext" id="myPopup">Popup text...</span>
</div> 

This is based on https://www.w3schools.com/howto/howto_js_popup.asp