问题在Google Chrome中打印iFrame [英] Issue in printing iFrame in Google Chrome

查看:358
本文介绍了问题在Google Chrome中打印iFrame的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个iframe,像

I have an iframe like

<iframe id="Frame1" name="Frame1" style="width: 810px;overflow:hidden;height:525px;border:none;"src="templates/template1.html">
</iframe>

当我点击生成按钮
时,生成函数会调用。

When I click generate button the generate function will call.In generate function i changed the src of the iframe to template2.html.

    <input type="button"  id="btngenerate" onclick="Generate();"/>
    <a id="print" onclick="OnPrint();">Print</a>

点击生成按钮后点击打印链接,我想打印iframe。 / p>

When I click on the print link after clicking the generate button,I want to print the 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(); 时,它会打印整个页面。
请帮助我...

It works in Firefox. But not in chrome. In chrome the template1.html will be printed.I want to print template2.html. When I call window.print(); it will print the whole page. Please help me...

推荐答案

是否可以使用单独的窗口打印内容就像我在这里描述的 https://stackoverflow.com/a/23281929/701869 )?

Is it possible for you to use a separate window to print your content (like I described here https://stackoverflow.com/a/23281929/701869) ?

这篇关于问题在Google Chrome中打印iFrame的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆