IE打印frame中内容的效能

IE打印frame中内容的功能
下面是2个例子,只要部署到TOMCAT中,就可以运行

index.jsp
<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<script type="text/javascript">   
     var HKEY_Root,HKEY_Path,HKEY_Key;    
     HKEY_Root="HKEY_CURRENT_USER";    
     HKEY_Path="\\Software\\Microsoft\\Internet Explorer\\PageSetup\\";    
     //设置网页打印的页眉页脚为空    
     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){
	           alert(e);
	       }    
      }
      //恢复网页打印的页眉页脚   
      function PageSetup_default(){    
        try {    
            var Wsh=new ActiveXObject("WScript.Shell");    
	        HKEY_Key="header";    
	        Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"&w&b页码,&p/&P");    
	        HKEY_Key="footer";    
	        Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"&u&b&d");    
        }catch(e){
        	alert(e);
        }    
      }    
      
		function printsetup(){ 
		  PageSetup_Null(); 
		// 打印页面设置 
		 wb.execwb(8,1); 
		} 

		function printpreview() {
			var win = document.frames('report');
		    win.focus(); 
			win.wb1.execwb(7,1);// 打印预览 
		}
		
		function printit() {
			if (confirm('确定打印吗?')) { 
				PageSetup_Null(); 
				var win = document.frames('report');
			    win.focus();
			    win.print();
				PageSetup_default();
			} 
		} 
 
		function excel(){
			 window.open(document.frames('report').location.href+"&reportType=excel");
		}
</script>

<body>
<object classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height=0 id=wb name=wb width=0></object> 
<input type=button name=button_print value="打印"
	onclick="javascript:printit()" />
<input type=button name=button_setup value="设置"
	onclick="javascript:printsetup();" />
<iframe name="report" id="report" src="main.jsp" width="100%"
	height="700px"
	style="marginwidth: 110px; marginheight: 110px; background-color: grey; border: 5px solid #ddd"
	frameborder="0"> </iframe>
</body>
</html>




main.jsp
<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
<title>Insert title here</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
	<input  type="text" value="phl"/><br/>
	<input  type="password" value="123456"/><br/>
	 <input type="submit" name="Submit" value="提交" />
</form>
</body>
</html>