The various methods of JavaScript pop-up windows summarize _javascript techniques

Source: Internet
Author: User

Copy Code code as follows:

Close, Parent window pop-up dialog box, child window close directly
This. Response.Write ("<script language=javascript>window.close ();</script>");

Close, neither the parent window nor the child window pops up the dialog box and closes directly
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 without
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 success '); window.window.location.href= ' WebForm2.aspx '; </script> ");

Closes the current child window and 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 popup child window (webform2.aspx)
This. Response.Write (' <script language= ' JavaScript ' >alert (' published success! '); window.open (' webform2.aspx ') </script> ");

Pop-up Prompt window, OK, refresh parent window
This. Response.Write (' <script>alert success! ');window.opener.location.href=window.opener.location.href;</script> ");

The same page pops up
<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 is to be written in one line
-->
</SCRIPT>

  
Parameter explanation:
  
<script language= "javascript" > JS script started;
window.open the command to eject a new window;
The filename of the ' page.html ' pop-up window;
' NewWindow ' pop-up window name (not filename), not required, available null ' instead;
height=100 window height;
width=400 window width;
The pixel value of the Top=0 window from the top of the screen;
The pixel value of the left=0 window from the left side of the screen;
Toolbar=no whether the toolbar is displayed, yes for display;
Menubar,scrollbars represents the menu bar and scroll bar.
Resizable=no whether to allow changes to the window size, yes to allow;
Location=no whether the address bar is displayed, yes is allowed;
Status=no whether the information in the status bar is displayed (usually the file is open), yes to allow;
</SCRIPT> JS script End

' Newwin ': Hide menu bar Address bar toolbar
WIDTH=50: Width
HEIGHT=50: Height
scrollbars=yes/n scroll bar
TOP=50: Window from the top of the screen
LEFT=50: Window from left side of screen
Cases:

Copy Code code as follows:

window.open (' detail.aspx?id= ' +e.item.cells[1]. text+ "', ' newwin ', ' width=750,height=600,scrollbars=yes,top=50,left=50 ');");
This. Response.Write (' <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> ");

Cases:
Copy Code code as follows:

This. Response.Write (' <script>alert success! ');window.opener.location.href=window.opener.location.href;</script> ");
This. Response.Write ("<script>");
This. Response.Write ("{Top.opener =null;top.close ();}");
This. Response.Write ("</script>");

Cases:
Copy Code code as follows:

Linkcolumn1. datanavigateurlformatstring= "Javascript:varwin=window.open (' edit_usr.aspx?actid={0} ', ' Newwin ', ' width=750, Height=600,scrollbars=yes,top=50,left=50 '); Window.close () ";

Related Article

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.