开发者

Indication bar in iframe loading inconsistently in IE.

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 co开发者_StackOverflow社区mming 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>


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜