在服务器端完成一些事件后,我需要打印网页,但 window.print 无法正常工作。我如何解决这个问题。我的页面源代码
<asp:ImageButton ID="butPrint" runat="server" ImageUrl="~/Images/print.gif"
ToolTip="Click to Print"
onclick="butPrint_Click" />
protected void butPrint_Click(object sender, ImageClickEventArgs e)
{
///my events
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "print", "printPage();", true);
}
function printPage() {
// here i have hide some controls
window.print();
}
这适用于 Firefox,但不适用于 IE 8