【发布时间】:2014-01-31 10:01:58
【问题描述】:
我正在使用 Jquery 插件 PrintThis.js 和 jquery-1.7.2.min.js 来打印我网页的特定 div。它在 Firfox 和 IE 中运行良好。但不幸的是,它不适用于 Google Chrome。实际上,谷歌浏览器正在打印完整的网页,包括横幅、菜单和按钮。我在网上搜索了很多,但找不到合适的解决方案
这是我的示例代码
Java 脚本
$(function () {
$("input:button").click(function () {
$("#print").printThis();
});
});
HTML
<body>
<input type="button" value="print" />
<div id="print">
this is print area, it can be everything. this is print area, it can be everything.this is print area, it can be everything. this is print area, it can be everything.
</div>
</body>
在 Google Chroome 的此页面中,该按钮也将被打印,但我不想打印此按钮,并且相同的代码在 Firefox 中运行良好,令人惊讶的是在 IE 中它也运行良好
【问题讨论】:
标签: javascript html jquery-plugins