Will Alert () Fail to redirect the page?

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.