Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DIsplay a temporary message while script is executing? 1

Status
Not open for further replies.

frumpus

Programmer
Aug 1, 2005
113
US
I have an ASP page that runs a bit slow so I need to display a 'processing you request' type message when the code begins to execute and then clear that and replace it with the desired information after the script is finished. I don't know how to do this properly.

I tried something like this but the 'processing' page did not display until all the code had finished running and then I ended up with it and the 'finished' page stacked on top of each other.

Code:
<% @LANGUAGE = VBScript %>
<%
'a little code is here
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
   <html>
   <body>
   <p>Processing your request</p>  
   </body>
   </html>

<%
'here is the bulk of the code
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
   <html>
   <body>
   <p>Finished!</p>  
   </body>
   </html>

Can anyone tell me how to display an interim message before the code finishes and then replace it at the end?
 
Update: I have discovered that I can push the 'processing' message to the browser before the code finishes using Response.Flush

However, I would still like to be able to wipe that message out and replace it the 'finished' message rather than have 'finished' displayed beneath 'processing'.

Is this possible using the Response object or some other method?
 
Ok I have read the FAQ on doing this but I can't seem to get it working.

Here is a sample page I wrote just to test the 'Processing' message. It displays the processing message before it executes the code just fine, but it does not remove it afterward. I still end up with "Request processed successfully." displayed UNDER the 'processing' message instead of it being replaced.\

Can anyone tell me what is wrong here?

Code:
<% @LANGUAGE = VBScript %>
<%
Option Explicit
Response.Buffer = False
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
   <script language="javascript">
   <!--
      function remProcessing(){
	     document.getElementById("Processing").style.display = "none";}
   //-->
   </script>
  </head>

   <body onLoad="remProcessing"> 
	 <div id="Processing">
	  <p>Proccessing your request. This may take a few minutes.</p>
	  <p><img src="images/progress_bar.gif"></p>
	 </div> 
	 
<% 
   Dim i 
   i = 5000
   Do While i > 0
      i = i - 1
   Loop
%>

   <p>
   <font color="#009900"><strong>Request processed successfully.</strong></font>
 </body>
</html>
 
Nevermind. I was missing the parenthesis at the end of the function call.

<body onLoad="remProcessing()">

works just fine.
 
If you have found an error in a FAQ, please use the link at the bottom of that FAQ to contact the owner so he can change it if necessary

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top