Javascript实现IE直接打印
2012-07-09 15:02
477 查看
1.页面插入:
注:打印内容为"<!--startprint-->"..."<!--endprint-->"之间页面内容,所以须将这两个标记插入到<body>标记中间。
如下代码所示:
<script language="javascript" type="text/javascript"> function preview() { bdhtml = window.document.body.innerHTML; sprnstr = "<!--startprint-->"; eprnstr = "<!--endprint-->"; prnhtml = bdhtml.substr(bdhtml.indexOf(sprnstr) + 17); prnhtml = prnhtml.substring(0, prnhtml.indexOf(eprnstr)); window.document.body.innerHTML = prnhtml; window.print(); window.document.body.innerHTML = bdhtml; } </script>
注:打印内容为"<!--startprint-->"..."<!--endprint-->"之间页面内容,所以须将这两个标记插入到<body>标记中间。
如下代码所示:
<form id="form1" runat="server"> <!--startprint--> <div style="border:dottted"> <br /> Dear <asp:Label ID="lb_Name" runat="server"></asp:Label> ,<br /> <br /> With reference to the outstanding invoice,please note that it remains outstanding till today.Kindly advice payment details if payment has been made,otherwise kindly expedite the payment.Attached are the invoice details.Please ensure that payment reaches us <div id="byDay" runat="server"></div><br /> <br /> <b>If payment is not received within 3 months for SDF funded courses from the completion of the course,we will resend a debit note,reflecting the unclaimed SDF amount for your settlement.<br /> If payment is not received within 60 Days from Date of Invoice,we will impose a late payment penalty charge of 2% interest per month</b><br /> <br /> Should you require furtther clarifications on the said invoice,please do not hesitate to contact Finance Department at 63237911.<br /> <br /> Kind Regards,<br /> Aileen LIEW<br /> AR & Admin <br /> <br /> </div> <!--endprint--> <div style="text-align:center"> <asp:Button ID="btn_Print" runat="server" Width="60px" Text="Print" OnClientClick="preview()" /> </div> </form>
相关文章推荐
- JavaScript实现点击按钮直接打印
- javascript实现firefox和IE都支持的页面局部打印
- javascript结合WebBrowser实现打印预览、直接打印、页
- JavaScript实现点击按钮直接打印
- javascript结合WebBrowser实现打印预览、直接打印、页
- javascript实现firefox和IE都支持的页面局部打印
- JavaScript实现点击按钮直接打印
- 在 IE 中用VBScript 实现不提示直接打印
- 利用JavaScript实现简单的拖动层(只使用于IE)
- js实现IE、谷歌浏览器打印网页内容
- javascript+xml实现简单图片轮换(只支持IE)
- JavaScript利用IE内置打印控件IEWebBrowser进行打印
- 调用MyReport实现js直接打印
- 在Javascript(js)或Jquery中直接实现超链接跳转代码示例!
- javascript 实现打印,打印预览,打印设置
- 执法文书打印的实现(四):调用ie打印预览
- IE 下自带打印控件,直接打印,完成测试,可用。
- Javascript 实现打印的部分功能
- javascript实现兼容ie与firefox下dom的xpath
- JavaScript IE打印接口带自动分页