<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>JavaScript</title>
  <script>
    function addClick() {
      const element = document.querySelector("section > button");
      element.addEventListener("click", showmessage);
    }
    function showmessage() {
      alert("You pressed the button");
    }
    window.addEventListener("DOMContentLoaded", addClick);
  </script>
</head>
<body>
  <section>
    <h1>Website</h1>
    <button type="button">Show</button>
  </section>
</body>
</html>