<!--- Javascript that makes it all happen --->
<script>
   /**
   * Set the messageid to 1 not 0
   * This will make sure case 1 is executed
   */

   var message_id =1;
   function get_message() {
      
/**
      * Add all the cases below.
      * Make sure to include the "break" after specifying each case.
      */

      switch (message_id) {
         case 1:
         message = "Fetching user information.... ";
         break;
      
   // __________________________________________________//
         case 2:
         message =
"Setting session...";
         break;
         
// __________________________________________________//
         case 3:
         message =
"Setting cookies ....";
         break;
         
// __________________________________________________//
         case 4:
         message =
"Logging in...";
         break;
         
// __________________________________________________//
         default:
         message =
"";
         
// __________________________________________________//
   }

      message_id = message_id+1; // increment this value by one after each case is executed.
      msgbx.value = message; // this is to show the messages in "case" above in the message box below
      return message_id; // this is used by the next function, so it can use the incremented values
   }
   /** ************************************************************** */

   function message_update() {
      if (get_message() < 5) {
         setInterval('get_message()',2000);
         /**
         * set the interval of things to happen for 2 seconds each.
         * note, that this also runs just fine with setTimeout function
         */

   }
}
/** ************************************************************** */
</script>

<!---//
       // Now control look and feel
       // The style below will make textbox transparent
       // And will use the default (arrow) cursuor when client howers mouse over the text box
       //--->

<style>
       .messagebox{
                     background-color: transparent;
                     border-width:0px;
                     cursor:default;
       }
</style>

<body onLoad="message_update();" bgcolor="#999999">
<!---//
       // Call the javascript function when boady loads
       // make fix the body background color to your taste
       //--->

<input type="text" name="msgbx" class="messagebox">
<!---//
       // This is the place where the messages will be displayed
       //--->
</body>

<!---//
// ADDITIONAL NOTES:
// You can also use <script> tag withing <cfoutput> tags.
// By doing this, you will be able to display server-side data at given intervals
// You may be able to use something like chr(10), "[][][][]..." to fill this textbox, to simulate a progress bar. In that case use --> message+=#chr(10)#
// For example at the 3rd timeout, say, you can fill other textboxes with FirstName, LastName, etc...
// You will also be able generate those "Please wait" and "Loading..." messages, by tweaking this script
// to run when a long running query is executed in the background. (may be use with cfflush)
// Or display several messages before redirecting the user to a different page.
// ------------------------------------------------------------------------------------------------------ //
// Remember, however, that this is like a "dummy" script, and it based on time, and not actual execution of events
// but you can use it for events
// --->

About This Tutorial
Author: Anang A Phatak
Skill Level: Beginner 
 
 
 
Platforms Tested: CF1,CF2,CF3,CF4,CF5,CFMX,CFMX7
Total Views: 110,115
Submission Date: May 19, 2005
Last Update Date: June 05, 2009
All Tutorials By This Autor: 12
Discuss This Tutorial
Advertisement


Website Designed and Developed by Pablo Varando.