[英]Issue in printing iFrame in Google Chrome
我有一個iframe
<iframe id="Frame1" name="Frame1" style="width: 810px;overflow:hidden;height:525px;border:none;"src="templates/template1.html">
</iframe>
當我單擊生成按鈕時,將調用生成函數。在生成函數中,我將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();
它將打印整個頁面。 請幫我...
您是否可以使用單獨的窗口來打印您的內容(就像我在這里描述的https://stackoverflow.com/a/23281929/701869 )?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.