Navi
09-29-2007, 10:40 PM
Hi expert, How to presesent the waiting message for a few seconds and then direct the user to a new page after he clicks the login button in asp.net. Appreciate it!
|
Click to See Complete Forum and Search --> : wait message Navi 09-29-2007, 10:40 PM Hi expert, How to presesent the waiting message for a few seconds and then direct the user to a new page after he clicks the login button in asp.net. Appreciate it! Cstick 09-30-2007, 12:38 AM You want to let your users know that the system is working so they don't go click crazy, right? There might be some slicker ways to do it, but the typical trick is to handle the click event of the login button with javascript, display your waiting message and then let the event continue to bubble up. That way the user sees your friendly message till the browser recieves the response from the server. Navi 10-01-2007, 10:37 PM Thank you! Would you please provide me some reference? Thanks again! Cstick 10-02-2007, 01:01 AM <script type="text/javascript"> /*<!--*/ window.onload = function() { var loginMessage = document.getElementByID("LoginMessage"); var loginButton = document.getElementByID("LoginButton"); loginButton.click = function() { loginMessage.style.display = "block"; return true; } } //--> </script> Navi 10-02-2007, 11:55 PM Thank you, Sticker! Do I have to add some code to the button of the body? How to make the button to call the function? Appreciate it! Cstick 10-03-2007, 08:33 PM The block of code is only an example, it will need to be changed accordingly to match your form. But it will hopefully get you started in a good direction. This code is not necessarily compliant across all web browsers either. If you don't use a library to assist you with your javascript, then I recommend you look at the Prototype (http://www.prototypejs.org/) library, it will make your job easier and your code better. This line handles the load event of the window, basically it executes the inline function after the window is loaded: window.onload = function() { These two lines create references to the login message and the button by their IDs, your IDs will vary: var loginMessage = document.getElementByID("LoginMessage"); var loginButton = document.getElementByID("LoginButton"); This block handles the click event of the button and displays the login message, the way in which you choose to show and hide your message may vary. loginButton.click = function() { loginMessage.style.display = "block"; //The return true causes the button event to continue //and the page to be submitted. return true; } webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |