【发布时间】:2020-07-16 19:06:54
【问题描述】:
我创建了一个 JavaScript 函数来打印 iFrame 的内容。
<a href="#" onclick="printBGReport();" align="center">Print Report</a> <br/>
<script>
function printBGReport(){
var content = document.getElementById("printBGReport").innerHTML;
var mywindow = window.open('', 'Print', 'height=600,width=800');
mywindow.document.write(content);
mywindow.document.close();
mywindow.focus()
mywindow.print();
mywindow.close();
//return;
}
</script>
<div id="printBGReport">
<iframe id="reportBGID" name="reportBGID" src="myiFrameURL" width="900" height="1000" align="center" target="_self" valign="top" scrolling="yes" frameborder="no">
</div>
但是,它并未打印所有内容。看起来它只是打印第一页。有谁知道为什么?
谢谢
【问题讨论】:
-
iframe 内容的结构是怎样的? “首页”是什么意思?
-
iframe 内容在我的
-
它只是打印到 iframe 高度。 height="1000"
标签: javascript html