我有一个iframe
<iframe id="Frame1" name="Frame1" style="width: 810px;overflow:hidden;height:525px;border:none;"src="templates/template1.html">
</iframe>
当我点击生成按钮时 generate函数将调用。在generate函数中,我将iframe的src更改为template2.html。
<input type="button" id="btngenerate" onclick="Generate();"/>
<a id="print" onclick="OnPrint();">Print</a>
单击生成按钮后单击打印链接时,我想打印iframe。
function generate()
{
var billPath = "templates/template2.html";
$("#Frame1").attr("src", billPath);
}
function onPrint()
{
window.frames["Frame1"].window.focus();
window.frames["Frame1"].window.print();
}
适用于Firefox。但不是铬。
在chrome中将打印template1.html。我想打印template2.html。
当我拨打window.print();
时,它将打印整个页面。
请帮帮我......