Home > Web Front-end > JS Tutorial > body text

Summary of various methods of Javascript pop-up windows_javascript skills

WBOY
Release: 2016-05-16 17:16:28
Original
2061 people have browsed it

Copy code The code is as follows:

//Close, the parent window pops up a dialog box, and the child window Close directly
this.Response.Write("");

//Close, neither the parent window nor the child window will pop up a dialog box, close it directly
this.Response.Write("<script>");<br>this.Response.Write("{top.opener =null;top.close();}");<br>this.Response.Write("</script>");

//The pop-up window refreshes the current page width=200 height=200 menu. There are no menu bar, toolbar, address bar, or status bar
this.Response.Write("");

//The pop-up window refreshes the current page
this.Response.Write("");
this. Response.Write("<script>window.open('WebForm2.aspx','_blank');</script>");

//The pop-up prompt window jumps to the webform2.aspx page (in an IE window)
this.Response.Write(" ");

//Close the current child window and refresh the parent window
this.Response.Write("<script>window.opener.location.href=window.opener.location.href;window.close();&lt ;/script>");<br>this.Response.Write("<script>window.opener.location.replace(window.opener.document.referrer);window.close();</script>" );

//The child window refreshes the 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. After confirmation, a sub-window (WebForm2.aspx) will pop up
this.Response.Write("");

//A prompt window pops up. After confirmation, refresh the parent window
this.Response.Write("<script>alert('Published successfully!');window.opener.location.href=window.opener. location.href;</script>");

//The same page pops up

//
Response.Write("parent.mainFrameBottom.location.href='yourwebform.aspx?temp=" str "';");



 
Parameter explanation:
 
end of js script

'newwin': Hide menu bar address bar toolbar
width=50: width
height=50: height
scrollbars=yes/n scroll bar
top=50: window distance from screen Above
left=50: The distance between the window and the left side of the screen
Example:

Copy the code The code is 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>");

Example:
Copy code The code is as follows:

this.Response.Write("<script>alert('发表成功!');window.opener.location.href=window.opener.location.href;</script>");
this.Response.Write("<script>");<br>this.Response.Write("{top.opener =null;top.close();}");<br>this.Response.Write("</script>");

例:
复制代码 代码如下:

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 labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!