javascript - 不带预览/对话框直接打印

标签 javascript jquery html css

有没有什么方法可以通过单击一个按钮直接打印内容,而无需预览或打印对话框?我的代码

<head>
<style type="text/css">

#printable { display: none; }

@media print
{
    #non-printable { display: none; }
    #printable { display: block; }
}
</style>
</head>
<body>
<div id="non-printable">
    MY normal page contents
</div>

<div id="printable">
    Printer version
</div>
</body>

最佳答案

不,你不能“安静地”打印

关于javascript - 不带预览/对话框直接打印,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13667417/

相关文章:

javascript - Visual Studio Code 中的 Beautif/Tidy (Javascript)

jquery - 绑定(bind)函数中的文本替换

javascript - 禁用输入字段填充 1 个字符时自动跳转到下一个输入字段

html - 如何在单击图像时开始播放嵌入式 iframe 视频

asp.net-mvc - 使用 "tel:"标签时,出现 "A potentially dangerous Request.Path value was detected from the client (:). "错误

javascript - 如何使用 fadeIn() 过渡到最后一张幻灯片

javascript - 移动滑动菜单可滚动

javascript - 单击链接时如何显示特定的 div 并隐藏其他的?

javascript - AngularJS 选项卡通知

javascript - 如何使用 jquery 清空嵌套 <li> 中的 <ul>