setcookie-js.html

<!DOCTYPE html>

<html lang="en">
  <head>
    <title>JavaScript cookie</title>
    <meta charset="utf-8"/>
    <script src="setcookie-js.js"></script>
  </head>
  <body>
    <h1>Hello, visitor!</h1>
    <div>
      Your name: <input type="text" id="visitor_name" />
    </div>
    <div>
      <button type="button" id="showButton">Show Cookie</button>
    </div>
    <p>Go <a href="printcookies.php">here</a> to see cookies.</p>
</html>