【发布时间】:2015-04-13 23:31:26
【问题描述】:
单击一个按钮,它会运行 PrintInvoice,它使用 jquery printElement(嗯,1.2 版)打开一个窗口,其中 div 包含一个按钮和一个 iframe,以及打印对话框:
<script type="text/javascript" language="javascript">
function PrintInvoice() {
$('DIV#EInvoice').printElement({
printMode: 'popup',
leaveOpen: true,
});
}
</script>
其中相关元素如下:
<div id="EInvoiceWrapper">
<div id="EInvoice" style="overflow: hidden">
<center>
<a style="display: block; width: 100%; height: 100%; background: url(API/OAL/img/btnCloseWindow.jpg) no-repeat top center;"
href="javascript: window.close()"></a>
</center>
<br />
<iframe id="PrintableInvoice" name="PrintableInvoice" src="https://www.whatever.com/OrderInvoice.aspx" frameborder="0" scrolling="no" style="width:590px; height:750px !important;"></iframe>
</div>
</div>
正确弹出一个包含 EInvoice div 内容的窗口并加载打印对话框,但托管页面显示一个垂直滚动条。
当然会在打印文档中呈现。我需要在没有滚动条的情况下打印此页面(我对它是否显示在弹出窗口中无动于衷。)目前用户取消了“打印”对话框,右键单击实际发票,然后从那里打印(这样做了正确没有滚动条)。
我尝试过的事情:在 iframe 上设置高度,在 div 上设置高度,将不同的设置传递给 printElement printBodyOptions,大约一百万个其他事情。
我认为我需要做的是让 iframe 中托管的页面扩展到其全高,因此它不需要显示滚动条。我无法控制托管的 OrderInvoice.aspx。
我该怎么做?或者还有什么其他方法可以隐藏滚动条?
【问题讨论】:
-
你还没有找到这篇文章 - Remove scrollbar from iframe吗?似乎下面的答案将重申这里已经提出的观点。我假设你做到了,那么不幸的是我也认为@Neaox 的答案是正确的。
-
我认为他们在谈论实际 iframe 上的滚动?我的问题是 iframe 中托管的页面。
标签: javascript jquery iframe