Document directory
- Will Alert () Fail to redirect the page?
Will Alert () Fail to redirect the page?
In this case, you cannot see alert (). The page is redirected directly to index. asp without any pause.
/** // * The code is represented by a pseudo code */
Add a record
Response. Write ("<script language = javascript> alert ('added successfully'); </script> ");
......
Response. Redirect ("index. aspx ");
If you remove the redirection, You can see alert (). The page remains in the new page.
More strangely, if: Alert ("the record is added successfully! "); // Method defined by the system BasePage.
Response. Write ("<script language = javascript> alert ('aaa'); </script> ");
Alert ('aaa') And then Alert ("record added successfully! ")
Time: 17: 21
Thanks for your help. The general problem can be solved as follows: Response. write ("<script modify Ge = 'javascript '> alert ('Modified successfully'); window. location. href = 'index. aspx '</script> ");
But what if alert () has a variable that is defined in the program rather than in the script? For example, what if alert needs to print the "current record number" + successfully modify it?
But what if alert () has a variable that is defined in the program rather than in the script? For example, what if alert needs to print the "current record number" + successfully modify it?
Time: 17: 57. The problem was finally solved.
String a = the current record variable;
Response. write ("<script language = 'javascript '> alert ('" + a + "modified successfully '); window. location. href = index. aspx '</script> ");
Finally, we have solved the problem. Thank you.