English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Example as follows:
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>js print print the specified area of the web page simple example</title> </head> <script> function myPrint(obj){ var newWindow=window.open("Print Window","_blank"); var docStr = obj.innerHTML; newWindow.document.write(docStr); newWindow.document.close(); newWindow.print(); newWindow.close(); } </script> <div id="print"> <hr /> Print demonstration area, click to print and the content here will be loaded in a new window! <hr /> </div> <button onclick="myPrint(document.getElementById('print'))">Print</button> </html>
This is the full content of the simple example of js print printing the specified area of the web page brought to you by the editor. I hope everyone will support and cheer for the tutorial~