javascript关闭弹出窗体时刷新父窗体和居中显示弹出窗
居中显示用到了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关闭弹出窗体时刷新父窗体和居中显示弹出窗的更多相关文章
- winform打开子窗体后,在子窗体中刷新父窗体,或者关闭子窗体刷新父窗体
winform打开子窗体后,在子窗体中刷新父窗体,或者关闭子窗体刷新父窗体,搜集了几个方法,列举如下: 一 . 所有权法 父窗体,名称为“fuForm”,在父窗体中有个公共刷新方法,也就是窗体数据初始 ...
- Winform 子窗体设置刷新父窗体
方法1:所有权法 父窗体:Form1 子窗体:Form2 //Form1:窗体代码 //需要有一个公共的刷新方法 public void Refresh_Method() { //... } / ...
- C# Form窗体子窗口关闭时刷新父窗体中的datagridview
解决该问题可以用委托,但是还有更简单方便的两种方法: 方法一:将主窗体实例保存到子窗体 show form2的时候设置一下 owner为form1 Form2 f2 = new Form2(); / ...
- Extjs 窗体居中,双重窗体弹出时清除父窗体的鼠标事件
这个是监控窗体缩放的事件 缩放中居中主要在 'beforeshow' 和 'destroy'两个事件里面监控 var EditTempWindow; Ext.EventManager.onWindow ...
- js后台提交成功后 关闭当前页 并刷新父窗体(转)
原文地址:http://www.cnblogs.com/chenghu/p/3696433.html 后台提交成功后 关闭当前页 并刷新父窗体 this.ClientScript.RegisterSt ...
- js后台提交成功后 关闭当前页 并刷新父窗体
后台提交成功后 关闭当前页 并刷新父窗体 this.ClientScript.RegisterStartupScript(this.GetType(), "message", &q ...
- 关闭open页面时刷新父页面列表
var winObjEI = window.open("/Invoice/InvoiceViewEI?invoiceid=" + data.InvoiceId); ; //关闭op ...
- silverlight子窗体操作数据库后刷新父窗体
silverlight子窗体操作数据库后刷新父窗体 作者 Kant 写于 2011 年 07 月 02 日 分类目录 学习笔记, 所有文章 C# Silverlight 代码 刷新 学习 异步刷新 数 ...
- Winfrom子窗体刷新父窗体
本人比较懒,直接从网上转载了一篇比较合适的文章,只是文章格式有点乱,地址是 http://aspnet.blog.163.com/blog/static/17515510920121126104433 ...
随机推荐
- linux之软硬链接【转】
链接---------是一种在共享文件和访问它的用户的若干目录项之间建立联系的一种方法. Linux中包括两种链接:硬链接(Hard Link)和软链接(Soft Link),软链接又称为符号链接(S ...
- spring整合jedis时所遇问题
@Test public void testSpringJedisPool(){ ApplicationContext ac = new ClassPathXmlApplicationContext( ...
- 洛谷 P1014 Cantor表【蛇皮矩阵/找规律/模拟】
题目描述 现代数学的著名证明之一是Georg Cantor证明了有理数是可枚举的.他是用下面这一张表来证明这一命题的: 1/1 1/2 1/3 1/4 1/5 … 2/1 2/2 2/3 2/4 … ...
- python第三方库安装-多种方式
第一种方式:安装whl文件 pip install whatever.whl 第二种方式:安装tar.gz文件 一般是先解压,然后进入目录之后,有setup.py文件 通过命令 python se ...
- js上传Excel文件
一.问题 需要在项目里添加一个上传excel文件的功能,因为其他同样的后台里面有上传文件的功能,第一反应就是想着直接用.了解了一下发现它是利用bootstrap的fileinput实现的,但是我怎么都 ...
- CentOS7安装部署jumpserver0.5
组件说明 Jumpserver为管理后台,管理员可以通过Web页面进行资产管理.用户管理.资产授权等操作; Coco为SSH Server和Web Terminal Server.用户可以通过使用自己 ...
- 基于WPF系统框架设计(7)-TextBox/PasswordBox在ViewModel中支持回车命令
应用场景 我现在做一个系统登录功能,要求在PasswordBox上输完密码后回车,能够响应Enter事件,并执行ViewModel中对应的方法.如果登录成功则隐藏当前窗口显示主窗体,登录失败则焦点返回 ...
- Android 蓝牙技术 实现终端间数据传输
蓝牙技术在智能硬件方面有很多用武之地,今天我就为大家分享一下蓝牙技术在Android系统下的使用方法技巧.蓝牙是一种短距离的无线通信技术标准,蓝牙协议分为4层,即核心协议层.电缆替代协议层.电话控制协 ...
- php分页显示文章列表
<div class="content"> <ul> <?php $querySel = "select * from news where ...
- hdu1708(C++)
这个题目明确说了不涉及大数,假设第i个为b[i]: b[0]=s1; b[1]=s2; b[3]=s1+s2; b[4]=s1+2*s2; b[5]=2*s1+3*s2: b[6]=3*s1+5*s2 ...