asp.net form Operation Summary _ Practical Tips

Source: Internet
Author: User
1. Open a new window
This is simple: Response.Write ("<script language= ' JavaScript ' >window.open (' url ');</script>");
2. Resize and position this window
Response.Write ("<script>window.resizeto (500,400);</script>");
Response.Write ("<script>window.moveto (300,200);</script>");
3. Close the window
Closes the current window and prompts the user to close, yes close, no exit
Response.Write ("<script language= ' JavaScript ' >window.close ();</script>");
Delay Close the window (the following code indicates 2 seconds to close without confirmation)
Response.Write ("<script language= ' JavaScript ' >settimeout (' self.close () ', Watts);</script>");
  
4. Delay Time
This is not much different from the above. I used the situation is, in the user's operation has been given a hint n seconds, the page turned "and so just remove the 2 heavy self.close () can
Response.Write ("<script language= ' JavaScript ' >settimeout (", Watts);</script> ");
  
5. Pop-up prompts or Warning window
Response.Write ("<script language= ' JavaScript ' >alert (' Add success, page will automatically jump after 2 seconds ');</script>");
6. Refresh other Pages
The use of the situation is still a lot of, for example, in the face of the data update and modify, another page A to maintain the latest data to the customer, which is to be completed in the case of the B-operation to a refresh:
Response.Write ("<script language= ' JavaScript ' >window.opener.location.href= './default.aspx ') </script> ");
  
7. Page Jump
Sometimes in the case of the need to give a hint of the page jump, can not use Response.Redirect ("url");
For example, when the customer completes the operation, click the button to submit, pop-up prompt box (using 3 and 4 above), if the use of the
Response.Redirect ("url");
Then the page will not give a hint, that is, 3 and 4 do not work directly to the turn.
If you are following the process of operation:
1. Response.Write ("<script language= ' JavaScript" >alert (' Add success, page will automatically jump after 2 seconds ');</script> ");
2). Response.Write ("<script language= ' JavaScript ' >settimeout (", Watts);</script> ");
3). Page Turn:
Response.Write ("<meta http-equiv= ' refresh '/>");

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.