【发布时间】:2014-10-31 04:07:47
【问题描述】:
我的 html 代码中有 2 个 div 标签。页面顶部有 1 个打印按钮。当我点击打印按钮时,它会在打印中为我提供 html 页面上的所有内容(意味着来自两个 div 的内容)。我想将此打印按钮的功能限制到仅第一个 div,并且我将在下一个 div 之前添加另一个打印按钮以独立打印该 div 内容。有什么办法可以做到吗?
<html>
<body>
<input type="button" value="Print" class="noprint" onclick="window.print();return false;">
<div>
...
//my content.Want to print only this div when I will click print button.
...
</div>
//I will add another print button here which will allow me to print the next div.
<div>
...
//my content
...
</div>
</body>
</html>
【问题讨论】: