Print the required content on the Web. Here is a simple setting:
<SCRIPT type = "text/JavaScript"> // print var hkey_root, hkey_path, hkey_key; hkey_root = "HKEY_CURRENT_USER "; hkey_path = "\ Software \ Microsoft \ Internet Explorer \ pagesetup \"; function doprint () {pagesetup_null (); // set the page header, footer, and page width. bdhtml?##doc ument. body. innerhtml; sprnstr = "<! -- Startprint --> "; // print start point eprnstr =" <! -- Endprint --> "; // print the destination prnhtml = bdhtml. substr (bdhtml. indexof (sprnstr) + 17); prnhtml = prnhtml. substring (0, prnhtml. indexof (eprnstr); Specify your doc ument. body. innerhtml = prnhtml; window. print (); // print pagesetup_default (); // restore the page header, footer, page width, and other information} // sets the function pagesetup_null () for printing the required page width, page header, and footer () {try {var regwsh = new activexobject ("wscript. shell "); hkey_key =" Header "; regwsh. regwrite (hkey_root + hkey_path + hkey_key, ""); hkey_key = "footer"; regwsh. regwrite (hkey_root + hkey_path + hkey_key, ""); hkey_key = "margin_bottom"; regwsh. regwrite (hkey_root + hkey_path + hkey_key, "0.200000"); hkey_key = "margin_left"; regwsh. regwrite (hkey_root + hkey_path + hkey_key, "0.200000"); hkey_key = "margin_right"; regwsh. regwrite (hkey_root + hkey_path + hkey_key, "0.200000"); hkey_key = "margin_top"; regwsh. regwrite (hkey_root + hkey_path + hkey_key, "0.200000");} catch (e ){}}// Restore the default page width, header, and footer
Function pagesetup_default () {try {var regwsh = new activexobject ("wscript. shell "); hkey_key =" Header "; regwsh. regwrite (hkey_root + hkey_path + hkey_key, "W & B page number, & P/& P (& W)"); hkey_key = "footer"; regwsh. regwrite (hkey_root + hkey_path + hkey_key, "& U & B & D ");
Hkey_key = "margin_bottom"; regwsh. regwrite (hkey_root + hkey_path + hkey_key, "0.750000"); hkey_key = "margin_left"; regwsh. regwrite (hkey_root + hkey_path + hkey_key, "0.750000"); hkey_key = "margin_right"; regwsh. regwrite (hkey_root + hkey_path + hkey_key, "0.750000"); hkey_key = "margin_top ";
Regwsh. regwrite (hkey_root + hkey_path + hkey_key, "0.750000");} catch (e ){}}
</SCRIPT>
<HTML> <body> <div> it is not included in the print area, so you do not need to set it. </Div> <Object ID = "webbrowser" classid = "CLSID: 8856f961-340a-11d0-a96b-00c04fd705a2" Height = "0" width = "0" viewastext> </Object> <! -- Of course, this sentence is needed. --> <! -- Startprint --> <div> This is where printing is needed. </div> <Div class = "noprint"> class = "noprint" does not need to be printed, you can set the class attribute of any tag to remove unnecessary printing. <Input id = "btnprint" type = "button" value = "print" onclick = "javascript: doprint ();"/> </div> <! -- Endprint --> </body> In this way, you can simply print the required web content.