居中显示用到了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. nodeJS学习(9)--- nodeJS模块:exports vs module.exports

    模块简介: 通过Node.js的官方API可以看到Node.js本身提供了很多核心模块 http://nodejs.org/api/ 这些核心模块被编译成二进制文件,可以 require('模块名') ...

  2. Js 中 == 与 === 的区别

    1.对于string,number等基础类型,==和===是有区别的 1)不同类型间比较,==之比较“转化成同一类型后的值”看“值”是否相等,===如果类型不同,其结果就是不等 2)同类型比较,直接进 ...

  3. Cover

    [题目描述] 有 N 个时间段,某个时间段可能包含其它时间段. 请找出能包含其它时间段最多的那个段,并计算出它包括的其它时间段有多少? [数据范围] 1 <= N <= 25,000 1  ...

  4. 倒计时浏览器跳转JavaScript

    原文发布时间为:2008-10-11 -- 来源于本人的百度文章 [由搬家工具导入] <html> <head> <title>显示时间</title> ...

  5. time stamp in javascript

    JavaScript 获取当前时间戳: 第一种方法: var timestamp = Date.parse(new Date()); 结果:1280977330000 第二种方法: var times ...

  6. HTTP Header中Accept-Encoding

    HTTP Header中Accept-Encoding 是浏览器发给服务器,声明浏览器支持的编码类型[1]  常见的有 Accept-Encoding: compress, gzip //支持comp ...

  7. wireshark过滤数据

    Wireshark使用WinPCAP作为接口,直接与网卡进行数据报文交换.用来获取网络数据封包,包括http,TCP,UDP,等网络协议包.使用者可以以免费的代价取得软件与其源代码,并拥有针对其源代码 ...

  8. hdu 1573(中国剩余定理)

    X问题 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submiss ...

  9. springBoot 类注释和方法注释

    File->Settings->Live Templates 新建组 类: /** * @Auther: test * @Date: $date$ * @Description: */ 编 ...

  10. perl learning

    Perl 中文教程 http://cn.perlmaven.com/perl-tutorial learning perl in about 2 hours 30 minutes http://qnt ...