<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Form Values</title>
  <script>
    function show() {
      const message = document.getElementById("mymessage").value;
      alert(message);
    }
    function initiate() {
      const button = document.getElementById("button");
      button.addEventListener("click", show);
    }
  </script>
</head>
<body onload="initiate()">
  <section>
    <form name="myform">
      <p><input type="text" name="message" id="mymessage"></p>
      <p><button type="button" id="button">Show Message</button></p>
    </form>
  </section>
</body>
</html>