ASP. NET Method 1:
Response. write ("<script language = \" javascript \ "> window. open ('aaa. aspx ', 'new window, \ "toolbar = Yes, location = No, directories = Yes, status = Yes, menubar = Yes, resizable = Yes, scrollbars = Yes \"); </SCRIPT> ");
This methodCodeEach time it is generated at the top of the page
ASP. NET to open a new window method 2:
String strscript = "";
Strscript + = "<script language = \" javascript \ "> \ n ";
Strscript + = "window. open ('aaa. aspx ', 'new window, \ "toolbar = Yes, location = No, directories = Yes, status = Yes, menubar = Yes, resizable = Yes, scrollbars = Yes \"); \ n ";
Strscript + = "location.hrefw.'index.html ';";
Strscript + = "</SCRIPT> ";
Bool B = (PAGE) system. Web. httpcontext. Current. Handler). isstartupscriptregistered ("popup ");
If (! B)
{
(Page) system. Web. httpcontext. Current. Handler). registerstartupscript ("popup", strscript );
}
In this way, JavaScript code is generated on the page.
Note: If the page jumps to another page with response. Redirect after the javsscript statement is output, JavaScript will not appear.
The pop-up window and jump must be included in the Javascript Statement at the same time,
I tested it. Do you have any different opinions ??
Multiple methods to open a new window in Asp.net
1. response. Redirect ("XXX. aspx", true) -- go directly to the new page and replace the original window;
2. response. write ("<SCRIPT> window. open (XXX. aspx '','' _ blank '') </SCRIPT>") -- the original window is retained, and a new page is added;
3. response. Write ("<SCRIPT> window. Location = xxx. aspx'' </SCRIPT> ") -- open a new page and replace the original window;
4. server. Transfer ("XXX. aspx") -- open a new page;
5. response. Write ("<SCRIPT> window. showmodelessdialog (XXX. aspx'') </SCRIPT> ") -- retain the original window and open a new window in the form of a dialog box;
6. response. Write ("<SCRIPT> window. showmodaldialog (XXX. aspx'') </SCRIPT> ") -- open a new window in the dialog box. The original window is replaced;
------------------------
Category:. NET technology ASP. NET
----------------------------------------------------------------------
The following statement can be correctly executed:
Response. Write ("<script language = JavaScript> window. Open ('repair. aspx? UN = "+ usernumber +" & SID = "+ serviceid +" ') </SCRIPT> ");
But cannot be executed after parameters are added? As follows:
Response. Write ("<script language = JavaScript> window. Open ('repair. aspx? UN = "+ usernumber +" & SID = "+ serviceid +" ', 'toolbar = No, status = no') </SCRIPT> ");
----------------------------------------------------------------------
Response. Write ("<script language = JavaScript> window. Open ('repair. aspx? UN = "+ usernumber +" & SID = "+ serviceid +" ', '', 'toolbar = No, status = no') </SCRIPT> ");
Let's take a look!
--------------------------------------------------------
Replace comma with semicolon toolbar = no; scrollbars = No
--------------------------------------------------------
okay, thank you.
------------------------------------------
multiple methods for opening new windows in Asp.net (reprinted)
1. response. redirect ("XXX. aspx ", true) -- directly redirects to the new page, and the original window is replaced;
2. response. write (" ") -- the original window is retained, and a new page is added.
3. response. write (" ") -- open a new page and replace the original window.
4. server. transfer ("XXX. aspx ") -- open a new page;
5. response. write (" ") -- the original window is retained and a new window is opened in a dialog box.
---------------------