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
How to optimize photo collages for social media and printing
How to print horizontally in Word Excel all versions
How to print multiple pages on one sheet of paper in Word 2010, 2013
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