views:

135

answers:

1

Hi Everyone.

The problem i am facing is ..

I am using below code structure for presentation . its jsp page. Usually, during get operation on database records( in hundreds), 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 enable bar would be shown till page loads completely. I am doing this using an iframe inside a div. And the moment body loads completely, I am going to hide the div and iframe.

The problem am getting is, the indicator bar is not comming up consistently. If i loads( click to navigate the page), sometimes the indicator is comming up and sometimes not. Browser i am using is IE Please help.

<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>
A: 

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.

machineghost