我可以修改这个Javascript从Div打印图像
Can I Modify this Javascript to Print Images from Div?
我有一个div在我的页面布局,我想打印。我已经完成了一些示例代码如何做到这一点,并得出以下结论:
<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.1.min.js" > </script>
<script type="text/javascript">
function PrintElem(elem)
{
Popup($(elem).text());
}
function Popup(data)
{
var mywindow = window.open('', 'print_div', 'height=400,width=600');
mywindow.document.write('<html><head><title>Print Window</title>');
mywindow.document.write('</head><body >');
mywindow.document.write(data);
mywindow.document.write('</body></html>');
mywindow.document.close();
mywindow.print();
return true;
}
</script>
然后在HTML正文中放置以下按钮:
<input type="button" value="Print Division" onclick="PrintElem('#print_div')" />
这对于在页面上创建基于文本的内容的快速打印非常有用,但我需要它做的是打印出正在显示在页面上的图像。我可以修改这个脚本来做到这一点吗?
你就不能这样做:
function PrintElem(elem)
{
Popup($(elem).html());
}
参考:http://api.jquery.com/html/
相关文章:
- 使用CSS打印DIV内容,不起作用
- 如何将选定的日期月份和年份打印到不同的DIV标签中
- For循环只打印一个DIV标记.不是8个DIV标签
- Div背景图像打印空白
- 使用显示/隐藏单选按钮将数组打印到 Div
- Div 中的文本/字体大小在 Firefox 的打印模式下与在“正常”模式下不同
- 将 JavaScript 结果打印到两个 DIV 而不是输入中
- 如何使用 Jquery 或 Javascript 打印出多个 Div
- 打印包含动态图像的Div
- 如何使用window.print()打印具有水平和垂直滚动条的DIV的全部内容
- 使用带有背景图像的html2canvas将Div打印为PNG
- 使用javascript打印DIV的内容
- 如何打印可滚动的DIV内容
- 为什么我的Div只打印两次?
- 如何在使用JavaScript函数打印时打印隐藏的DIV
- 用javascript打印问题…Div是一个空字符串
- 使用JQuery打印DIV内容
- 在IE/FireFox/Chrome中横向打印DIV
- 我可以修改这个Javascript从Div打印图像
- 使用AngularJs打印Div内容