print the contents of a web page

 <!DOCTYPE html>

<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Placeat illum nostrum beatae fugit, est sapiente temporibus at? Numquam, libero? Placeat id fuga sed, nisi consectetur sunt nulla eum architecto magnam.

  </p>
  <button id="print">Print</button>

  <script>
    let print2 = document.getElementById("print");
    print2.addEventListener("click"function(){
      window.print();
    })
  </script>
</body>
</html>

Comments

Popular posts from this blog

Write a JavaScript program to get the current date.

Store and display the values of text boxes of a form

Write a JavaScript program to count and display the items of a dropdown list, in an alert window