Page is Served successfully but showing error in the status bar.. of the browser...

Purpose of the Script is to load an Gif image before page Loads..
Here is the Script..

<script type="text/javascript" language="javascript"> 
       
       /// To load the gif before page servers.. while delaying..
       	if(document.getElementById) { // IE 5 and up, NS 6 and up, FF
			var upLevel = true;
		}
		else if(document.layers) { // Netscape 4
			var ns4 = true;
		}
		else if(document.all) { // IE 4
			var ie4 = true;
		}

		function showObject(obj) {
			if (ns4) {
				obj.visibility = "show";
			}
			else if (ie4 || upLevel) {
				drawMessageBox();
				obj.style.visibility = "visible";		
			}
		}

	        showObject('splashScreen');

		function hideObject(obj) {
			if (ns4) {
				obj.visibility = "hide";
				}
			if (ie4 || upLevel) {
				obj.style.visibility = "hidden";
				}
			}

		function drawMessageBox()
		{
		    var box = "<div id='splashScreen' style='position:absolute;z-index:5;top:30%;left:35%;'>"
		             +"<table cellpadding='0' cellspacing='0'>"
		             +"<tr><td style='width:100%; height:100%;font-family:Tahoma;' align='center'>"
		             +"<br /><br />"
		             +"<IMG src='masterimages/bigrotation2.gif' BORDER='0' Name='Progress'/>"
		             +"  Loading Please wait..."
		             +"</td><td></td></tr>"
		             +"</table>"
		             +"</div>";
		             
		             document.write(box);
		}
    </script>



<body>
     <% Response.Flush();%>
    <form id="form1" runat="server">
      <% System.Threading.Thread.Sleep(3000);%>

  <% Response.Flush();%>   
    <script type="text/javascript" language="javascript"> 
		if(upLevel) {
			var splash = document.getElementById("splashScreen");
			}
		else if(ns4) {
			var splash = document.splashScreen;
			}
		else if(ie4) {
			var splash = document.all.splashScreen;
			}
		hideObject(splash);
</script>

Recommended Answers

All 2 Replies

function showObject(obj) {
   if (ns4) {
      obj.visibility = "show";
   }
   else if (ie4 || upLevel) {
      drawMessageBox();
      obj.style.visibility = "visible";
   }
}

showObject('splashScreen');

You are calling your function with a string, then trying to set the style of it. You need to use document.getElementById(obj) after drawMessageBox() to turn that string in to an object.

Can i ask what your implementation of this is? Hoe are you using it, and why do you need to display a floating div in front of the page to tell the user it is loading?

I'm not criticizing or anything, I just don't think i've ever seen something like this done before and would love to be enlightened.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.