JavaScript 調用 Windows 的打印 代碼
2009-02-24 10:36
<%@ Page Language="C#" AutoEventWireup="true" Codebehind="Default.aspx.cs" Inherits="CRInerPrint._Default" %> <%@ Register Assembly="CrystalDecisions.Web, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" Namespace="CrystalDecisions.Web" TagPrefix="CR" %> <!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>Untitled Page</title> <link href="/aspnet_client/system_web/2_0_50727/CrystalReportWebFormViewer3/css/default.css" rel="stylesheet" type="text/css" /> <script type="text/javascript"> function printpage(m_printpage) { var newstr=document.getElementById(m_printpage).innerHTML;//document.all.item(m_printpage1).innerHTML var oldstr = document.body.innerHTML; document.body.innerHTML=newstr; window.print(); document.body.innerHTML = oldstr; return false; } </script> <link href="/aspnet_client/system_web/2_0_50727/CrystalReportWebFormViewer3/css/default.css" rel="stylesheet" type="text/css" /> <link href="/aspnet_client/system_web/2_0_50727/CrystalReportWebFormViewer3/css/default.css" rel="stylesheet" type="text/css" /> </head> <body> <form id="form1" runat="server"> <div id="m_printpage"> <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="True" DisplayGroupTree="False" HasCrystalLogo="False" HasDrillUpButton="False" HasToggleGroupTreeButton="False" HasViewList="False" Height="1039px" ReportSourceID="CrystalReportSource1" Width="773px" /> <CR:CrystalReportSource ID="CrystalReportSource1" runat="server"> <Report FileName="C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\CRInerPrint\CRInerPrint\CrystalReport1.rpt"> </Report> </CR:CrystalReportSource> </div> </form> <input id="Button1" type="button" value="button" onclick="javascript:printpage('m_printpage')" runat="server" /> </body> </html>