将数据发送到打印机 [英] Sending data to printer
本文介绍了将数据发送到打印机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用php我创建了动态表,其中包含我数据库中的所有学生。我现在想添加一个打印机图标,当用户点击该图标时,将该表发送给打印机?我在很多页面上看过它,但它是如何完成的? Tnx提前...
Using php I created dynamical table, which contains all students from my database. I would like now to add an icon of printer, and when user clicks on that icon, to send this table to printer? I saw it on many pages, but how it's done? Tnx in advance...
推荐答案
只需使用 window.print()
。
jQuery中的示例:
Simply use window.print()
.
Example in jQuery:
<script>
$(function() {
$("#print").click(function() {
window.print();
});
});
</script>
<a id='print'>Print ME</a>
JavaScript中的示例:
Example in JavaScript:
<script>
function printMe() {
window.print()
}
</script>
<input type="button" value="Print" onclick="printMe()">
这篇关于将数据发送到打印机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文