print.html 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  2. <OBJECT id=WebBrowser classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 width=0 VIEWASTEXT></OBJECT>
  3. <style type="text/css">
  4. table{
  5. border-collapse: collapse;
  6. }
  7. td{
  8. border-bottom: 1px solid #000000;
  9. border-right: 1px solid #000000;
  10. border-left: 1px solid #000000;
  11. border-top: 1px solid #000000;
  12. padding-bottom: 5px;
  13. padding-top: 5px;
  14. padding-left: 12px;
  15. padding-right: 5px;
  16. }
  17. </style>
  18. <div id="div_print" align="center">
  19. </div>
  20. <script>
  21. var HKEY_Root, HKEY_Path, HKEY_Key;
  22. HKEY_Root = "HKEY_CURRENT_USER";
  23. HKEY_Path = "\\Software\\Microsoft\\Internet Explorer\\PageSetup\\";
  24. //设置网页打印的页眉页脚为空
  25. function PageSetup_Null() {
  26. try {
  27. var Wsh = new ActiveXObject("WScript.Shell");
  28. HKEY_Key = "header";
  29. Wsh.RegWrite(HKEY_Root + HKEY_Path + HKEY_Key, "");
  30. HKEY_Key = "footer";
  31. Wsh.RegWrite(HKEY_Root + HKEY_Path + HKEY_Key, "");
  32. } catch (e) {
  33. console.log(e);
  34. }
  35. }
  36. function print2() {
  37. PageSetup_Null();
  38. debugger;
  39. document.all.WebBrowser.ExecWB(6, 2);
  40. }
  41. </script>