Print pages in JavaScript
Many times you will love to put a button on your website to print the content of that page through a printer. JavaScript helps you perform this function by using the print function of the window object.
The window.print () function in JavaScript prints the current page when executed. You can call this function directly using the onclick event as in the following example:
For example
Try the following example:
You should read it
- Syntax of JavaScript
- What is JavaScript? Can the Internet exist without JavaScript?
- Learn about ES6 in Javascript
- What is JavaScript?
- Udemy's top 5 JavaScript courses
- How to Turn on JavaScript
- How to Enable JavaScript
- What is Currying in Javascript? How to use Currying in JavaScript
- Things to know about 'this' in JavaScript
- ! = and! == What is the difference in JavaScript?
- Top site with many good JavaScript exercises to practice
- Document Object Model (DOM) in JavaScript
Maybe you are interested
What is Digital Footprint?
Excel 2016 - Lesson 12: Formatting pages and printing spreadsheets in Excel
How to print multiple Word files at once on your computer
Instructions for managing print lists on iPhone
How to print Excel on 1 A4 page - Display full content on 1 page
Instructions on how to open when Print title in Excel is locked