|M| 如何在一个用页打印另一个页面的内容
如我在我的index.htm里面放了一个Botton
打印help
点打印的时候就打印出我的help.html页面的面容
谢谢
------解决方案--------------------晕!
------解决方案--------------------学习..等待高手来..
------解决方案--------------------===index.aspx中===========
<script>
function winopen(__URL)
{
window.open(__URL, "打印帮助 ", "toolbar=no,menubar=no,resizable=yes, scrollbars=yes,top=50px,left=50 ");
}
</script>
<input type= "button " id= "prtBt " value= "打印帮助 " onclick= "winopen( 'help.aspx?prt=yes '); " />
======help.aspx==========================
<%@ Page Language= "C# " AutoEventWireup= "true " CodeFile= "help.aspx.cs " Inherits= "help " %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN " "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns= "http://www.w3.org/1999/xhtml " >
<head runat= "server ">
<title> 无标题页 </title>
<Script language= "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 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, " ") ;
}
catch(e){}
}
// 设置页眉页脚为默认值
function PageSetup_Default()
{
try{
var RegWsh = new ActiveXObject( "WScript.Shell ") ;
hkey_key= "header " ;
RegWsh.RegWrite(hkey_root+hkey_path+hkey_key, "&w&b页码,&p/&P ") ;
hkey_key= "footer " ;
RegWsh.RegWrite(hkey_root+hkey_path+hkey_key, "&u&b&d ") ;
}
catch(e){}
}
// 打印
function PrintPage()
{
PageSetup_Null();
wb.execwb(6,1);
PageSetup_Default();
window.opener = null;
parent.close();
}
</Script>
</head>
<body>
<object classid= "CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 " height=0 id=WB name=wb width=0 VIEWASTEXT> </object>
<form id= "form1 " runat= "server ">
<div>
</div>
</form>
</body>
</html>
=======help.aspx.cs============
protected void Page_Load(object sender, EventArgs e)
{
if(!string.IsNullOrEmpty(Request[ "prt "]))
{
Page.RegisterStartupScript( "printhtml ", " <script> PrintPage(); </script> ");
}
}
------解决方案--------------------bottun 打开新窗体
help.aspx?print=1
help.aspx判断request.params