The first paragraph of the code, use css to control the scope of printing, the default is to print all pages of content, if some elements do not want to be printing, you can add a class = Noprint to achieve
<style media=print>
. Noprint (display: none ;}<!-- use this style when you print hidden at non-print items ->
. PageNext (page-break-after: always ;}<!-- control pagination ->
</ style>
The second paragraph of the code, set the header to the footer using the JavaScript code, the code is not necessary. This is by modifying the registry in print about the parameters ie, implementation of the modified header footer function. Can put a button on the page to call the function, can also be called when a page is loaded click on the PageSetup_Default () function.
<script language="JavaScript">
var HKEY_Root, HKEY_Path, HKEY_Key;
HKEY_Root = "HKEY_CURRENT_USER";
HKEY_Path = "\ \ Software \ \ Microsoft \ \ Internet Explorer \ \ PageSetup \ \";
/ / Set the page footer to print the header is empty
function PageSetup_Null ()
(
try
(
var Wsh = new ActiveXObject ( "WScript.Shell");
HKEY_Key = "header";
Wsh.RegWrite (HKEY_Root + HKEY_Path + HKEY_Key ,"");
HKEY_Key = "footer";
Wsh.RegWrite (HKEY_Root + HKEY_Path + HKEY_Key ,"");
)
catch (e) ()
)
/ / Set the page footer to print the header for the default value
function PageSetup_Default ()
(
try
(
var Wsh = new ActiveXObject ( "WScript.Shell");
HKEY_Key = "header";
Wsh.RegWrite (HKEY_Root + HKEY_Path + HKEY_Key, "& w & b on page 00 yards, & p / & P");
HKEY_Key = "footer";
Wsh.RegWrite (HKEY_Root + HKEY_Path + HKEY_Key, "& u & b & d");
)
catch (e) ()
)
</ script>
Header footer Detailed parameter settings inside:
The third paragraph of the code, Print Preview and Page Setup code. Put him into the appropriate location page, you can achieve by clicking the Print Preview button to achieve the print preview feature. Empty the following code in the page number and restore the page is only a supplementary option, rather than have to add, you can decide according to the actual situation there is no longer necessary.
<input type = "button" value = "empty page"
<input type = "button" value = "Recovery Page"
<input type = button value = Page Setup
<input type = button value = Print Preview
In addition some of them accompanied by a similar code, ie are some of the features of its own.
Since more code, so put a new page inside the:







