In the old system today, the user requested that a javascript alert message prompt should be changed to a Div tag for display. When it is displayed, it will only be displayed for a few seconds and then hidden, in this way, you do not need to click OK in the alert information box or close the button.
The following Insus. NET provides a simple example based on the implemented functions. The problems encountered in the implementation process are also analyzed and shared together.
First, create a xxx. aspx webpage on the asp.net Website:
Step 1: Create a div tag and add a Label control to it to display relevant information.
Step 2: Add a style.
Step 3: Add html markup, A TextBox and a Button in the aspx webpage, and Click the Button in code behind:
Now return to the html markup of aspx and add the jQuery code:
Step 5: reference the jQeury class library.
Step 6: Hide the Div tag three seconds after it is displayed.
Real-time operation and Demonstration:
Before Insus. NET modifies the old system, it also tries to test OK in this way and then move it to the old system to be modified, but there is no effect at runtime:
The message prompts the set time. The Div is not hidden and the effect is lost, as shown below:
The final check. In the old system, it was included in UpdatePanel. As a result, the functions and effects of the Application disappear. How can this problem be solved? Check msdn:
Http://msdn.microsoft.com/en-us/library/bb311028 (v = vs.100). aspx
Modify the javascript jQuery code according to the msdn technical documentation: