iframe 中的指示栏在 IE 中加载不一致。

发布于 2024-08-21 06:37:20 字数 975 浏览 2 评论 0原文

我使用下面的代码结构进行演示,这是一个 jsp 页面。通常,网页需要 3 秒以上才能完全加载。

我已经注入了一个指示器栏(类似于 cvi_busy),以便在页面完全加载之前显示一些启用 JavaScript 的栏。我正在使用 div 内的 iframe 来执行此操作。当正文完全加载时,我将隐藏 diviframe

我遇到的问题是指示器栏没有一致出现。加载时,有时会出现该指示器,有时则不会。我使用的浏览器是IE。

<html>
 <body>
    <div id="loadImageBarDiv">
    <iframe style="width:100%;height:100%;"  frameborder="0" name="loadingFrame" src="jsp/Splash.html" id="loadIframe" allowTransparency="true"/>
    </div>

    //---- my presentation for the page over here.
    </body>
    <script language="javascript">
if(window.frames['loadingFrame']){
if(window.frames['loadingFrame'].xval){
window.frames['loadingFrame'].xval.remove();}
window.frames['loadingFrame'].width="0px";
window.frames['loadingFrame'].height="0px";
}
document.getElementById("loadImageBar").style.display="none";
</script>
</html>

I am using the code structure below for the presentation, which is a jsp page. Usually, the web page takes more than 3 seconds to load completely.

I have injected an indicator bar (something like cvi_busy), so that some javascript enabled bar would be shown until the page loads completely. I am doing this using an iframe inside a div. And at the moment the body loads completely, I am going to hide the div and iframe.

The problem I am getting is that the indicator bar is not comming up consistently. When it loads, sometimes the indicator comes up and sometimes not. The browser I am using is IE.

<html>
 <body>
    <div id="loadImageBarDiv">
    <iframe style="width:100%;height:100%;"  frameborder="0" name="loadingFrame" src="jsp/Splash.html" id="loadIframe" allowTransparency="true"/>
    </div>

    //---- my presentation for the page over here.
    </body>
    <script language="javascript">
if(window.frames['loadingFrame']){
if(window.frames['loadingFrame'].xval){
window.frames['loadingFrame'].xval.remove();}
window.frames['loadingFrame'].width="0px";
window.frames['loadingFrame'].height="0px";
}
document.getElementById("loadImageBar").style.display="none";
</script>
</html>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

宣告ˉ结束 2024-08-28 06:37:20

如果您使用 jQuery,这应该很容易解决。只需这样做:

<script language="javascript">
$(function() {
  if(window.frames['loadingFrame']){
  if(window.frames['loadingFrame'].xval){
  window.frames['loadingFrame'].xval.remove();}
  window.frames['loadingFrame'].width="0px";
  window.frames['loadingFrame'].height="0px";
  }
  document.getElementById("loadImageBar").style.display="none";
});
</script>

在页面的开始处。 $(someFunction) 是 jQuery 连接事件处理程序“onReady”的快捷方式,这听起来像是您正在尝试做的事情。

If you use jQuery, this should be real easy to fix. Just do:

<script language="javascript">
$(function() {
  if(window.frames['loadingFrame']){
  if(window.frames['loadingFrame'].xval){
  window.frames['loadingFrame'].xval.remove();}
  window.frames['loadingFrame'].width="0px";
  window.frames['loadingFrame'].height="0px";
  }
  document.getElementById("loadImageBar").style.display="none";
});
</script>

At the start of the page. $(someFunction) is jQuery's shortcut for hooking up an event handler "onReady", which is what it sounds like you're trying to do.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文