- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
单击一个按钮,它会运行 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。
我该怎么做?或者还有哪些其他方法可以隐藏滚动条?
最佳答案
您无法将样式应用于 iframe 中的文档,因为它位于不同的域中。沙盒可以防止这种情况。为了实现您的要求,我的建议是缩小 iframe 的宽度,以便隐藏滚动条。
编辑:另一种解决方案可能是保持 iframe 宽度不变,并将 iframe 包装在另一个元素中(就像您对 #EInvoice
元素所做的那样),并为该包装元素提供更小的宽度比 iframe 小(比 iframe 的宽度小 15px 左右,你将不得不使用这个宽度差异来找到正确的值)并将溢出隐藏到元素(就像你对 #EInvoice
元素)。这将切断右侧的滚动条。
<div id="EInvoiceWrapper">
<div id="EInvoice" style="width:575px;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>
关于javascript - 在没有托管页面滚动条的情况下打印 iframe 的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28490878/
所以我知道,如果我将 iFrame 包含到不在同一域中的页面,我将无法通过浏览器策略访问该 iframe 的 DOM,但是 iframe 中的页面可以执行任何类型的父文档访问吗? 具体来说,我必须考虑
我有 3 个嵌套的 iframe,我想访问第三个 iframe 中的元素(链接)。 var iframe = document.getElementById('aswift_2'); var inne
Chrome 有最简单的方法,只需从下拉列表中选择一个框架即可。 Firefox 提供了 cd(frame)功能不太好用,但只要您愿意发现哪个框架是哪个框架就可以完成工作。 但是我们如何在 Inter
我们公司正在考虑允许第三方网站使用我们的在线结账系统。 一位客户表示,他们希望能够使用灯箱样式的弹出窗口来显示结帐。他们希望在网站的每个页面上都可以使用它,因此大多是不安全的页面。我们的结帐系统和客户
当 iframe 中加载的页面来自另一个域时,我们如何从 iframe 中加载的文档访问父文档? 我收到权限被拒绝错误。 最佳答案 如果您可以控制这两个文档,那么您可以轻松地使用 easyXDM (
使用 SOAP 调用我得到一个 URL 并在 iframe 中显示。那个 URL 内容是一个表单,用户需要填写所有数据并提交它。当我调用 SOAP 函数时,也给出了一个返回链接,其中一个重定向到我的站
我正在尝试开发一个小型 Web 应用程序,其中包含一个使用来自另一个域的 iframe 的 Web 应用程序。我正在尝试在本地计算机上对此进行测试,为此我需要模仿 iframe 来自另一个域(虽然它实
我有一个网页 指向另一个网站。我不希望这阻止页面其余部分的加载。有没有办法异步加载它? 最佳答案 使用 jQuery,可以实现以下效果: $(window).load(function() {
我搜索过高低,无法找到解决方案。在我看来,iframe API仅适用于较旧样式的网址,而不适用于较新的海关网址。 我的意思是,如果某人的YouTube网址为www.youtube.com/user/T
我想在我的网站上显示youtube视频。 iframe是可能的,我只需要像这样将其放在我的网页上。 一切都很好,除了我超过99%的客户来自伊朗,而且YouTube在伊朗被政府封锁。因此,直接从you
就目前情况而言,这个问题不太适合我们的问答形式。我们希望答案得到事实、引用资料或专业知识的支持,但这个问题可能会引发辩论、争论、民意调查或扩展讨论。如果您觉得这个问题可以改进并可能重新开放,visit
所以我有一个简单的页面,当用户单击链接时,iframe 将打开。我正在尝试使用 http://www.google.com/support/analytics/bin/answer.py?hl=en&
假设情况:我有一个名为“miniatureBoltsInCarburetors.com”的不起眼的小网站,该网站提供有关将化油器固定在一起的微型 bolt 的内容以及一些一般相关的汽车信息。我的网站还
IE 6.0 向我显示消息“此页面包含安全和非安全项目”,因为我的页面上有 iframe(针对组合框错误)。我尝试指向 src 中的一些不同的内容,但如果不放入空白的 html 页面,我似乎无法摆脱此
我有一个带有一个 iframe 和一个按钮的网页。 在页面加载事件中, if (!Page.IsPostBack) { string sDocUrl = //some doucmen url Ifra
我有一个带有一些 IFrame 的页面。这些 IFrame 位于同一域中。我想在打开模态窗口时从页面中删除 iframe 内容,以减少模态窗口中的延迟。 然后,当我关闭模态窗口时,我希望将 IFram
我正在尝试访问一个框架内的控件,该框架位于另一个框架内的框架内。 最后(最深的)框架仅用于登录 - 我设法做到了。 问题是登录后我基本上需要回到上框点击一个按钮。出于某种原因,我不断收到错误消息: N
我有下一个元素结构: .. actual markup with scripts here 使用纯 javascript,我已经摆脱
我们使用 Worldpay 作为我们的支付提供商,我们将 PayPal 作为 worldpay 的一部分实现,这意味着我们只与 Worldpay 集成,他们处理 PayPal 集成。 虽然这会带来很多
我有一个客户,由于特定原因,需要在 HTTP 页面上放置一个指向 HTTPS 页面的 IFRAME。 HTTP 页面托管在与 HTTPS 页面不同的域和服务器上,但都属于同一客户端。 撇开为什么不应该
我是一名优秀的程序员,十分优秀!