Print this JavaScript
You know those “Print this page” links that let you print the whole page? Yeah, those. Here is how to create one of those for your web page using JavaScript and HTML.
Add this code to any web page:
Thank you for your order. Please print this page for your records.</p> <script type="text/javascript"> (function printClick() { if (!document.getElementById("print_this")) return false; var link = document.getElementById("print_this"); if(link && typeof(window.print === 'function')) { var button = document.createElement('input'); button.setAttribute('type','button'); button.setAttribute('value','Print This!'); button.onclick = function() { window.print(); }; link.appendChild(button); } })(); </script>
Customize as needed. Cheers!