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 ...
随机推荐
- react当中两种获取表单数据的方法
方法一: 获取dom当中的数据 需要操作的dom上面有 ref="test", 当需要获取的时候 this.refs.test.value 就可以获取当前输入框的value值 ...
- 关于URL编码 [转]
转自: http://www.ruanyifeng.com/blog/2010/02/url_encoding.html 作者: 阮一峰 日期: 2010年2月11日 一.问题的由来 URL就是网址, ...
- ViewAnimator实现复杂的动画效果
咱们先看个原生的 AnimatorSet animatorSet = new AnimatorSet(); animatorSet.playTogether( ObjectAnimator.ofFlo ...
- Codeforces Round #466 (Div. 2) A. Points on the line[数轴上有n个点,问最少去掉多少个点才能使剩下的点的最大距离为不超过k。]
A. Points on the line time limit per test 1 second memory limit per test 256 megabytes input standar ...
- (持续集成)win7上部署Jenkins+MSBuild+Svn+SonarQube+SonarQube Scanner for MSBuild (第二发)
这一篇进入实战,走起.... 登录jenkins,如下图 点击上图中的“新建”按钮,进入下图 输入项目名称,选择“构建一个自由风格的软件项目”即可,点击“ok”,跳转到下图 svn源代码管理(选择代码 ...
- 我的CSS初始化,reset.css
* { margin:; padding:; text-decoration: none; -webkit-overflow-scrolling: touch !important; /*iOS惯性滚 ...
- C#中结构体与类的区别
一.结构体和类非常相似 1,定义和使用非常相似,例子如下:public struct Student{ string Name; int Age;}public class Questio ...
- ios大文件存储
I am using Erica Sadun's method of Asynchronous Downloads (link here for the project file: download) ...
- LAN、WAN、WLAN的区别
听语音 浏览:22034 | 更新:2015-06-22 20:10 | 标签:网线 1 2 3 4 5 6 7 分步阅读 好多朋友在群内问我路由器如何配置,本来还耐心解答,但是他竟然连LAN.WAN ...
- Error Code: 1055 incompatible with sql_mode=only_full_group_by
OperationalError at / (1055, "Expression #1 of ORDER BY clause is not in GROUP BY clause and co ...