---
title: "IE打印记录"
author: "simple_hui"
date: "2009-12-30T15:35:25Z"
tags: []
categories: ["Web前端"]
slug: "ie"
draft: false
lastmod: "2012-09-09T15:43:47Z"
id: 559771
url: "https://simple-hui.iteye.com/blog/559771"
---

打印时去掉下面的网址问题,打印预览界面可以打印的按钮，但是打印时不出现该按钮

function openwin() { 
//设置网页打印的页眉页脚为空 
  var HKEY_Root,HKEY_Path,HKEY_Key;
  HKEY_Root="HKEY_CURRENT_USER";
  HKEY_Path="\\Software\\Microsoft\\Internet Explorer\\PageSetup\\";
	 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){}
   window.print();  
   }

<div align="center" id="print" style="display:">
      <input name="Button" type="button" value="打印" onclick="openwin()">
</div>