The example in this article describes the way JavaScript calls the browser print feature. Share to everyone for your reference. Specifically as follows:
1. Universal type, support ie,firefox,chrome ...
Copy Code code as follows:
2. Only support IE print:
<script>
var print=function () {
/**
* WEBBROWSER.EXECWB (1,1) opens
* WEB.EXECWB (2,1) closes all IE windows now, and open a new window
* WEB.EXECWB (4,1) Save Web page
* WEB.EXECWB (6,1) Print
* WEB.EXECWB (7,1) Print Preview
* WEB.EXECWB (8,1) print page settings c11/>* WEB.EXECWB (10,1) view page Properties
* WEB.EXECWB (15,1) appears to be revoked, pending confirmation
* WEB.EXECWB (17,1) All
* WEB.EXECWB (22,1) Refresh
* WEB.EXECWB (45,1) Close form no hint
* *
document.getElementById (' printer '). EXECWB (6,1);
}
</script>
<object classid= "CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" id= "printer"
height= "0 "width=" 0 "></OBJECT>
<button onclick=" print (); " > Printing </button>
3. Control the print display area and pagination style:
. noprint {
display:none
}
. nextpage {
page-break-after:always;
}
I hope this article will help you with your JavaScript programming.