JS打印页面指定区域
2015-09-18 15:40
573 查看
错误的写法:
View Code
弄了一天,分页打印的时候还是有问题,如下图:
//打印 function printPage(areaId) { if (parent.$("#PrinFrame").length == 0) { parent.$("body").append('<iframe id="PrinFrame" style="display: none; "></iframe>'); } parent.$("#PrinFrame").attr("src", window.location.href); parent.$("#PrinFrame").one("load", function () { setTimeout(function () { var html = '<table style="width:970px;"><tr><td>'; html += $("#" + areaId).html(); html += '</td></tr></table>'; parent.$("#PrinFrame").contents().find("body").html(html); parent.$("#PrinFrame")[0].contentWindow.document.execCommand('Print'); }, 100); }); }
View Code
弄了一天,分页打印的时候还是有问题,如下图:
![](http://images2015.cnblogs.com/blog/174862/201509/174862-20150918175805570-1748675351.jpg)
相关文章推荐
- JS 生成名片、链接等二维码
- JSONArray的运用,读取长的String字符串
- javascript 创建对象的方式总结
- js插件大全
- JSON数据反序列化(解析)
- javascript之我见
- 使用接口解决JS文件冲突
- 10个免费开源的JS音乐播放器插件
- System.Windows.Forms.WebBrowser中 处理 js 脚本 window.Open 禁止新建窗口 的方法
- js小技巧
- FastJson之有道翻译
- JSP 内置对象
- JSONP理解
- JSON快速解析(Json和FastJson对比)
- 旗正规则引擎的使用----内存表的json转换
- JavaScript性能优化
- js事件(Event)知识整理[转]
- jsp 页面实现局部打印功能与全局打印
- javascript 异步模块加载 简易实现
- JavaScript中函数命名机制