window.print function code example Example: javascript window.print <button onclick="window.print()">Print this page</button>