0
我在我的网页上有一个div标签,它向右滚动很长的路。我想创建一个打印按钮,用户可以使用它打印div标签中的内容。 感谢您的任何帮助。如何设置打印div标签的内容
我在我的网页上有一个div标签,它向右滚动很长的路。我想创建一个打印按钮,用户可以使用它打印div标签中的内容。 感谢您的任何帮助。如何设置打印div标签的内容
像这样的事情
<html>
<head>
<style>
@media print {
.noprint {
display: none;
}
}
</style>
</head>
<body>
<div class="noprint">
Would not print
</div>
<div>
This would print
</div>
<div class="noprint">
Would not print
</div>
</body>
</html>
如果你想要一个基于JavaScript的解决方案,您使用jquery你可以使用这个插件: http://plugins.jquery.com/project/jqPrint
然后启动它在一个click事件。
$('#elementToClickOn').click(function() {
$("#divToPrint").jqprint();
});