javascript关闭弹出窗口时刷新父窗口和居中显示弹出窗
2014-12-23 14:51
519 查看
居中显示用到了moveTO()方法;
关闭弹出窗时刷新父窗口用到了window.opener方法;
父窗口代码如下:
子窗口代码如下:
关闭弹出窗时刷新父窗口用到了window.opener方法;
父窗口代码如下:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="弹出窗口.aspx.cs" Inherits="弹出窗口" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script type="text/javascript"> function cc() { var hdc = window.open('ChildWin.aspx', '弹出框', 'width=900,height=450,top=300,left=300'); width = screen.width; height = screen.height; hdc.moveTo((width - 900)/2,(height-450)/2);//居中显示 } </script> </head> <body > <form id="form1" runat="server"> <div> <input id="Button1" type="button" value="button" onclick="cc()"/></div> </form> </body> </html>
子窗口代码如下:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ChildWin.aspx.cs" Inherits="ChildWin" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script type="text/javascript"> function myCheck() { alert("关闭子窗口!"); window.opener.location.reload(); window.close(); } </script> </head> <body> <form id="form1" runat="server"> <div> <asp:BulletedList ID="BulletedList1" runat="server" Width="526px"> <asp:ListItem>1</asp:ListItem> <asp:ListItem>2</asp:ListItem> <asp:ListItem>3</asp:ListItem> <asp:ListItem>4</asp:ListItem> <asp:ListItem>5</asp:ListItem> <asp:ListItem>6</asp:ListItem> <asp:ListItem>7</asp:ListItem> <asp:ListItem>8</asp:ListItem> </asp:BulletedList> <br /> <input id="Button1" type="button" value="关闭" onclick="myCheck()"/></div> </form> </body> </html>
相关文章推荐
- javascript关闭弹出窗体时刷新父窗体和居中显示弹出窗
- javascript弹出及关闭窗口及页面刷新问题总结。
- JavaScript特效实例005-控制弹出窗口居中显示
- 已经可的窗体不能显示为模式对话框,关闭弹出修改窗口后主窗口DATAGRIDVIEW的刷新
- JavaScript弹出新窗口居中显示
- 解决JavaScript页面刷新 与 弹出窗口问题 无提示关闭窗口
- JavaScript基础 window.open(url,name,options) 弹出一个 新窗口 屏幕居中显示 获取屏幕的有效宽度
- JavaScript:关闭弹出窗口时刷新父窗口
- JavaScript:关闭弹出窗口时刷新父窗口
- 在Javascript 中实现window.open弹出窗口居中显示
- JavaScript:关闭弹出窗口时刷新父窗口
- jQuery弹出Div窗口居中显示、滚动跟随、关闭按钮以及几秒后自动消失
- JavaScript基础 window.open(url,name,options) 弹出一个 新窗口 屏幕居中显示 获取屏幕的有效宽度
- firefox弹出窗口关闭时执行代码--刷新父窗口
- Asp.Net中用javascript实现弹出窗口永远居中
- js让弹出新窗口居中显示的脚本
- 关闭弹出窗口刷新父窗口
- Asp.Net中用javascript实现弹出窗口永远居中
- js让弹出新窗口居中显示的脚本
- “当页面跳转或者关闭窗口时弹出提示窗口!”JAVASCRIPT实例