居中显示用到了moveTO()方法;

关闭弹出窗时刷新父窗体用到了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关闭弹出窗体时刷新父窗体和居中显示弹出窗的更多相关文章

  1. winform打开子窗体后,在子窗体中刷新父窗体,或者关闭子窗体刷新父窗体

    winform打开子窗体后,在子窗体中刷新父窗体,或者关闭子窗体刷新父窗体,搜集了几个方法,列举如下: 一 . 所有权法 父窗体,名称为“fuForm”,在父窗体中有个公共刷新方法,也就是窗体数据初始 ...

  2. Winform 子窗体设置刷新父窗体

    方法1:所有权法 父窗体:Form1    子窗体:Form2 //Form1:窗体代码 //需要有一个公共的刷新方法 public void Refresh_Method() { //... } / ...

  3. C# Form窗体子窗口关闭时刷新父窗体中的datagridview

    解决该问题可以用委托,但是还有更简单方便的两种方法: 方法一:将主窗体实例保存到子窗体 show  form2的时候设置一下 owner为form1 Form2 f2 = new Form2(); / ...

  4. Extjs 窗体居中,双重窗体弹出时清除父窗体的鼠标事件

    这个是监控窗体缩放的事件 缩放中居中主要在 'beforeshow' 和 'destroy'两个事件里面监控 var EditTempWindow; Ext.EventManager.onWindow ...

  5. js后台提交成功后 关闭当前页 并刷新父窗体(转)

    原文地址:http://www.cnblogs.com/chenghu/p/3696433.html 后台提交成功后 关闭当前页 并刷新父窗体 this.ClientScript.RegisterSt ...

  6. js后台提交成功后 关闭当前页 并刷新父窗体

    后台提交成功后 关闭当前页 并刷新父窗体 this.ClientScript.RegisterStartupScript(this.GetType(), "message", &q ...

  7. 关闭open页面时刷新父页面列表

    var winObjEI = window.open("/Invoice/InvoiceViewEI?invoiceid=" + data.InvoiceId); ; //关闭op ...

  8. silverlight子窗体操作数据库后刷新父窗体

    silverlight子窗体操作数据库后刷新父窗体 作者 Kant 写于 2011 年 07 月 02 日 分类目录 学习笔记, 所有文章 C# Silverlight 代码 刷新 学习 异步刷新 数 ...

  9. Winfrom子窗体刷新父窗体

    本人比较懒,直接从网上转载了一篇比较合适的文章,只是文章格式有点乱,地址是 http://aspnet.blog.163.com/blog/static/17515510920121126104433 ...

随机推荐

  1. javaScript 笔记(5) --- jQuery(上)

    这节整理整理 iquery.js 相关的内容... 目录 --- jQuery 语法 --- 文档就绪事件 --- jQuery 选择器 --- jQuery 事件 --- jQuery 效果 jQu ...

  2. 大陆争霸(bzoj 1922)

    Description 在一个遥远的世界里有两个国家:位于大陆西端的杰森国和位于大陆东端的 克里斯国.两个国家的人民分别信仰两个对立的神:杰森国信仰象征黑暗和毁灭 的神曾·布拉泽,而克里斯国信仰象征光 ...

  3. python安装matplotlib

    linux安装 方法: 首先matplotlib是需要numpy先行包支持的,这里,我已经安装了numpy,下面安装matplotlib. matplot需要一些其他软件支持 (1)这时需要安装fre ...

  4. Something about the microsoft HttpContext domain design

    1. HttpContext.Current.Request, Response 2.HttpHandler-> ProcessRequest 3.HttpModule-> Init, I ...

  5. js判断手机的左右滑动

    js代码 $(function() { function judge() { var startx;//让startx在touch事件函数里是全局性变量. var endx; var el = doc ...

  6. 气象城市ID列表

    气象城市ID列表 数据来源: http://cj.weather.com.cn/support/Detail.aspx?id=51837fba1b35fe0f8411b6df 记录了2574个地区,2 ...

  7. 基于Socket创建Web服务

    基于Socket创建Web服务 为什么要使用Socket呢,我们来看下图

  8. manjaro中okular中的pdf文件无法显示中文

    最近发现Manjaro下用Okular打开含有中文的PDF文档时,许多地方显示空白, 开始怀疑是中文字体问题,但是其他的软件中文显示都是正常的. 接着,调整Okular中的中文字体,显示还是不正常. ...

  9. sublime text3中成功使用bootstrap3

    在视图这里卡了挺久的,一直是自己在研究.其实自己有一个坏毛病,遇到问题,在网上搜集下找不到便寻求帮助(大多数是求助无效果,因为自己也没搞懂), 这时候自己就会懈怠一会,然后隔一两天心血起伏后便又继续干 ...

  10. 一个关于集合的问题,为什么添加进List集合中的元素被莫名其妙的改变了

    以前自己理解的不够深刻,特此记录一下提醒自己,如果正好也帮到了你,我会很开心.相信只有自己正好遇到这个问题,才觉得哦,原来这样.自己小白,大神莫喷 为什么添加进List集合中的元素被莫名其妙的改变了? ...