js打开新窗体,关闭父窗体 各位高手帮帮忙 请问如何通过JS打开新窗体,父窗体被锁定,关闭子窗体后刷新父窗体。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 请问如何通过JS打开新窗体windows.open()关闭子窗体后刷新父窗体。这个可以在父窗体上加个隐藏的按钮按钮的事件是刷新本页面当关闭子窗体后触发父窗体的这个按钮事件 js打开新窗体,关闭父窗体 Response.Write("<script>javascript:window.open('default.aspx','newwindow','');window.opener =null;window.open('','_self','');window.close();</script>"); Response.Write("<script>javascript:window.open('default.aspx','newwindow','');window.opener =null;window.open('','_self','');window.close();</script>"); Response.Write(" <script>javascript:window.open('default.aspx','newwindow','');window.opener =null;window.open('','_self','');window.close(); </script>"); 搂主标题写错了,你们看一下他的帖子内容 “父窗体被锁定” 而不是关闭父窗口。1楼的提议可以达到这个效果再给个urlhttp://msdn.microsoft.com/zh-cn/library/ms536759(en-us,VS.85).aspx window.showModalDialog();window.location.reload();这样好象可以了。 Response.Write("<script language=javascript>parent.window.opener=null;parent.window.dialogArguments.location.reload();window.close();</script>");或者function doModal(url){ win=window.showModalDialog(url,0,"dialogWidth:500px;dialogHeight:500px;status:no;help:no;"); document.location.reload();//js页面中加入这句话就行了} 打开window.showModalDialog(url);关闭刷新window.dialogArguments.location.reload(); 如何通过JS打开新窗体,父窗体被锁定,关闭子窗体后刷新父窗体。打开新窗口..用window.showModalDialog和window.open父窗体被锁定:就用模式窗口window.showModalDialog子窗体后刷新父窗体:parent.window.location.reload();或是parent.window.location.href="父窗口地址";//重新指一下父窗口地址 window.showModalDialog();是可以實現鎖定父頁面,但是父頁面一片空白,我要實現的是鎖定父頁面,但是可以看的到父頁面的資料 看看测试..照着新建两个页面q.htm是父页面,qq.htm是子页面..关闭子,会刷新父页面q.htm<HTML><HEAD><TITLE> New Document </TITLE></HEAD><BODY><SCRIPT LANGUAGE="JavaScript"><!--function ShowDialog(){ var rev = window.showModalDialog("qq.htm","dialogWidth:400px;dialogHeight:300px;scroll:no;status:no;resizable:no"); if(rev==1) {//太古界刷新 window.location.reload(); }}//--></SCRIPT><input type="button" value="Pop" onclick="ShowDialog();" /><input type="text" id="tbTest" /></BODY></HTML>qq.htm<HTML><HEAD><TITLE> New Document </TITLE></HEAD><BODY><SCRIPT LANGUAGE="JavaScript"><!--function CloseWin(){ window.returnValue = 1; window.close();}//--></SCRIPT><input type="button" value="关闭刷新父窗口" onclick="CloseWin();" /><span id="sp">asdfsafdasdfasdfasdfasdf</span></BODY></HTML> Response.Write("<script>window.showModalDialog('../framselect/framselect.aspx?&quedatesheets=" + datesheets + "','','dialogwidth:545px;dialogheight:440px;help:no');</script>");我的父頁面是框架的形式子頁面只是單獨的一個webfrom 正常使用是不会出现空白的..出现空白是因为你用Response.Write(" ")打出来的..因为Response.Write是在服务器端执行的..会写在客户端HTML页面的最顶上..你是不是用Response.End();了..用了就会空白 那你就是說我要用JS寫到HTML裏面咯; webform8.aspx 这个是你的右框架页面<!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></head><body> <form id="form1" runat="server"> <div><asp:TextBox ID="tx" runat="server"></asp:TextBox> <asp:Button ID="btnOK" runat="server" Text="开子窗口" OnClick="btnOK_Click" /> </div> </form></body></html>webform8.aspx.cs 父窗口后台代码protected void btnOK_Click(object sender, EventArgs e) { Page.ClientScript.RegisterStartupScript(this.GetType(), "openNew", "if(window.showModalDialog('webform9.aspx','','dialogwidth:545px;dialogheight:440px;help:no')==1){window.location.href='webform8.aspx';}; ", true); }webform9.aspx 子窗口<!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></head><BODY><SCRIPT LANGUAGE="JavaScript"><!--function CloseWin(){ window.returnValue = 1; window.close();}//--></SCRIPT><input type="button" value="关闭刷新父窗口" onclick="CloseWin();" /><span id="sp">asdfsafdasdfasdfasdfasdf</span></BODY></html>看看你是不是这个意思.. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm9.aspx.cs" Inherits="WebApplication3.WebForm9" %>webform8.aspx和webform9.aspx最上面的东东没有加上..意思你应该能看懂.. vs2008 母版页不显示 高分请教怎么实现这种效果,目前考虑采用iframe,但不知道怎末传值 关于弹出窗口返回值的保存问题 重大新闻,熟悉火狐浏览器的人进来, 大家帮我完善一下,自动生成sql语句方法 如何才叫熟悉??? 一个困惑我的问题,高手帮忙,不要见笑 自定义控件属性问题 aspx文件中的css控制有的不起作用。 图片如何浮动到右下角 100分求助:dropdownlist数据绑定后选择下拉列表后返回的值不变或为空 各位路过,问下网页页面加载会出现分段加载是什么技术?
windows.open()关闭子窗体后刷新父窗体。
这个可以在父窗体上加个隐藏的按钮按钮的事件是刷新本页面
当关闭子窗体后触发父窗体的这个按钮事件
1楼的提议可以达到这个效果再给个url
http://msdn.microsoft.com/zh-cn/library/ms536759(en-us,VS.85).aspx
window.location.reload();
这样好象可以了。
或者
function doModal(url){
win=window.showModalDialog(url,0,"dialogWidth:500px;dialogHeight:500px;status:no;help:no;");
document.location.reload();//js页面中加入这句话就行了
}
window.showModalDialog(url);
关闭刷新
window.dialogArguments.location.reload();
父窗体被锁定:就用模式窗口window.showModalDialog
子窗体后刷新父窗体:
parent.window.location.reload();
或是
parent.window.location.href="父窗口地址";//重新指一下父窗口地址
是可以實現鎖定父頁面,但是父頁面一片空白,我要實現的是鎖定父頁面,但是可以看的到父頁面的資料
q.htm<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>
<BODY>
<SCRIPT LANGUAGE="JavaScript">
<!--
function ShowDialog()
{
var rev = window.showModalDialog("qq.htm","dialogWidth:400px;dialogHeight:300px;scroll:no;status:no;resizable:no");
if(rev==1)
{//太古界刷新
window.location.reload();
}
}
//-->
</SCRIPT>
<input type="button" value="Pop" onclick="ShowDialog();" />
<input type="text" id="tbTest" />
</BODY>
</HTML>qq.htm<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>
<BODY>
<SCRIPT LANGUAGE="JavaScript">
<!--
function CloseWin()
{
window.returnValue = 1;
window.close();
}
//-->
</SCRIPT>
<input type="button" value="关闭刷新父窗口" onclick="CloseWin();" />
<span id="sp">asdfsafdasdfasdfasdfasdf</span>
</BODY>
</HTML>
我的父頁面是框架的形式
子頁面只是單獨的一個webfrom
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div><asp:TextBox ID="tx" runat="server"></asp:TextBox>
<asp:Button ID="btnOK" runat="server" Text="开子窗口" OnClick="btnOK_Click" />
</div>
</form>
</body>
</html>webform8.aspx.cs 父窗口后台代码protected void btnOK_Click(object sender, EventArgs e)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "openNew", "if(window.showModalDialog('webform9.aspx','','dialogwidth:545px;dialogheight:440px;help:no')==1){window.location.href='webform8.aspx';}; ", true);
}webform9.aspx 子窗口<!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>
</head>
<BODY>
<SCRIPT LANGUAGE="JavaScript">
<!--
function CloseWin()
{
window.returnValue = 1;
window.close();
}
//-->
</SCRIPT>
<input type="button" value="关闭刷新父窗口" onclick="CloseWin();" />
<span id="sp">asdfsafdasdfasdfasdfasdf</span>
</BODY>
</html>看看你是不是这个意思..
webform8.aspx和webform9.aspx最上面的东东没有加上..意思你应该能看懂..