Asp. NET pop-up window summary (essence, Kylin Chuang think)

Source: Internet
Author: User

Asp. NET pop-up window summary (essence, Kylin Chuang think)
Note:
//Close, parent window Pop-up dialog box, child window closes directly


This. Response.Write ("<script language=javascript>window.close ();</script>");


//Close, the parent window and child window do not pop up the dialog box, directly close


This. Response.Write ("<script>");
This. Response.Write ("{Top.opener =null;top.close ();}");
This. Response.Write ("</script>");


//Pop-up window refreshes the current page width=200 height=200 menu. menu bar, toolbar, address bar, status bar all No


This. Response.Write ("<script Language=javascript>window.open

(‘Rows.aspx‘,‘NewWindow‘,‘width=200,height=200‘)</Script>");


//Pop-up window refreshes the current page


This. Response.Write ("<script language=javascript>window.open (' rows.aspx ') </script>");
This. Response.Write ("<script>window.open (' webform2.aspx ', ' _blank ');</script>");


//Pop-up Prompt window jumps to webform2.aspx page (in an IE window)


This. Response.Write ("<script Language=javascript>alert (' registered as

Work‘); window.window.location.href=‘Webform2.aspx‘;</script> ");


//Closes the current child window, refreshes the parent window


This. Response.Write

("<script>window.opener.location.href=window.opener.location.href;window.close

();</Script>");
This. Response.Write ("<script>window.opener.location.replace

(window.opener.document.referrer); Window.close ();</Script>");


//child window refreshes parent window


This. Response.Write

("<script>window.opener.location.href=window.opener.location.href;</script>");
This. Response.Write ("<script>window.opener.location.href= ' WebForm1.aspx ';</script>");


//Pop-up Prompt window. OK after popup subwindow (webform2.aspx)


This. Response.Write ("<script language= ' javascript ' >alert (' published successfully! '); window.open

(‘Webform2.aspx‘)</Script>");

//Pop-up Prompt window, OK, refresh parent window


This. Response.Write ("<script>alert (' published as

Work!‘);window.opener.location.href=window.opener.location.href;</script> ");


//Pop Up the same page


<INPUT type="button"Value="Button"OnClick="Javascript:window.open (WINDOW.LOCATION.HREF)">

Response.Write ("parent.mainframebottom.location.href= ' yourwebform.aspx?temp=" +str+ "';"); <script language= "JavaScript" > <!--window.open (' page.html ', ' newwindow ', ' height=100, width=400, Top=0, left    =0, Toolbar=no,menubar=no, Scrollbars=no, resizable=no,location=n o, Status=no ')//This sentence to be written in one line--</SCRIPT> parameter explanation: <script language= "javascript" > JS script start, window.open popup New Window command, ' page.html ' pop-up window filename; ' newwindow ' pop-up window name (not text height=100 window height, width=400 window width, top=0 window to the pixel value above the screen, left=0 window from the pixel value on the left side of the screen; Toolbar=no whether the toolbar is displayed, Ye   S is displayed; Menubar,scrollbars represents the menu bar and scroll bar.   Resizable=no whether the window size is allowed, yes allows, location=no whether the address bar is displayed, yes is allowed, Status=no displays the information in the status bar (usually the file is open), yes is allowed; fullscreen maximized </SCRIPT> js script end ' Newwin ': Hide menu bar Address bar toolbar width=50: Width height=50: Height scrollbars=yes/no: Scroll bar top=50: Window is left=50 from above screen: Window distance to the left of the screen example: window.open (' detail.aspx?id= ' +e.item.cells[1]. text+ "', ' newwin ', ' width=750,height=600,scrollbars=yes,top=50,left=50 ');"); This. Response.Write ("&Lt Script>window.open (' webform2.aspx ', ' ', ' toolbar=no,location=no,directories=no,status=no,menubar=no, Scrollbars=no,resizable=yes,width=750,height=470,left=80,top=40 ');</script> "); [/quote] Example: this. Response.Write ("<script>alert" was published successfully! ');window.opener.location.href=window.opener.location.href;</script> "); Response.Write ("<script>"); Response.Write ("{Top.opener =null;top.close ();}"); This. Response.Write ("</script>"); Example: Linkcolumn1. datanavigateurlformatstring= "Javascript:varwin=window.open (' edit_usr.aspx?actid={0} ', ' Newwin ', ' width=750, Height=600,scrollbars=yes,top=50,left=50 '); Window.close () "; Response.Write ("<script>window.open" (' webform7.aspx ', ' ', ' toolbar=no,location=no,directories=no,status=no, Menubar=no,scrollbars=no,resizable=yes,width=750,height=470,left=80,top=40 ');</script> "); Popup is not related to the menu toolbar in your current window, just write a script in the page and it pops up. For example <a href=# onclick= "window.open (' xxx.aspx ', ' Window name ', ' parameters ');" >xxxxx</a> The following is a list of some pop-up window parameters, you can set your own, the parameters are separated by commas optional. String-Lists the object tables and separates them with commas. Each item has its own value, and they will be separated (for example: "Fullscreen=yes,toolbar=yes"). The following are the various features that are supported. Channelmode = {Yes | no | 1 | 0} Whether the ladder mode is displayed in the window. The default is No. directories = {Yes | no | 1 | 0} Displays the various buttons in the window. The default is yes. fullscreen = {Yes | no | 1 | 0} whether the browser is displayed in full-screen mode. The default is No. You need to be very careful when using this feature. Because this property may hide the browser's title bar and menu, you must provide a button or other hint to help the user close the browsing window. ALT+F4 can close the window. A full-screen window must use the ladder (channelmode) mode. Height = number Specifies the height of the window, in pixels. The minimum value is 100. left = number Specifies the distance, in pixels, of the window from the border of the box. The value must be greater than or equal to 0. Location = {Yes | no | 1 | 0} Specifies whether the address bar is displayed in the window. The default is yes. menubar = {yes | no | 1 | 0} Specifies whether the menu bar is displayed in a window. The default is yes. resizable = {Yes | no | 1 | 0} Specifies whether a handle that can be resized by the user is displayed in the window. The default is yes. scrollbars = {yes | no | 1 | 0} Specifies whether to display a horizontal or vertical scroll bar in the window. The default is yes. Status = {Yes | no | 1 | 0} Specifies whether the status bar is displayed in the window. The default is yes. titlebar = {Yes | no | 1 | 0} Specifies whether the title bar is displayed in the window. In the case of a non-invoking HTML application or a dialog box, this item is ignored. The default is yes. toolbar = {Yes | no | 1 | 0} Specifies whether the toolbar is displayed in a window, including buttons such as forward, back, stop, and so on. The default is yes. top = number Specifies the position of the top of the window, in pixels. The value must be greater than or equal to 0. width = number Specifies the width of the window, in pixels. The minimum value is 100. "1, the most basic popup window code" <script language= "JavascRipt "> <!--window.open (' page.html ')--</SCRIPT> because this is a javascripts code, so they should be placed between. is useful for browsers with low versions, where the code in the tag is not displayed as text in these old browsers. It's a good habit to develop. window.open (' page.html ') is used to control the popup new window page.html, if page.html is not in the same path as the main window, the path, absolute path (http://) and relative path (. /) are available. You can use both single and double quotes, just don't mix.   This piece of code can be added anywhere in the HTML, and between, can, between, the earlier the sooner executed, especially the page code is long, and want to make the page pop up as far as possible forward. "2, after the setting of the pop-up window" and then say the settings of the popup window. Just add a little something to the code above.     Let's customize the appearance of this pop-up window, size, pop-up position to fit the specific situation of the page. <script language= "JavaScript" > <!--window.open (' page.html ', ' newwindow ', ' height=100, width=400, Top=0, lef     T=0,toolbar=no, Menubar=no, Scrollbars=no, resizable=no,location=n o, Status=no ')//This sentence should be written in one line-</SCRIPT> Parameter explanation: <script language= "JavaScript" > JS script start, window.open popup New Window command; ' page.html ' popup filename; ' NewWindow ' popup window Name (not file name), non-mandatory, available empty ' ' instead of; height=100 window height, width=400 window width, top=0 window to pixel value above screen, left=0 window to pixel value from the left of screen, Toolbar=no display   toolbar, yes for display, Menubar,scrollbars for menu bar and scroll bar. Resizable=no whether the window size is allowed to change,Yes to allow, location=no whether to display the address bar, yes to allow, status=no whether to display the information in the status bar (usually the file is open), yes to allow; </SCRIPT> js script End "3, use function to control pop-up window"   The following is a complete code.

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.