各位高手帮帮忙
                      请问如何通过JS打开新窗体,父窗体被锁定,关闭子窗体后刷新父窗体。

解决方案 »

  1.   

    请问如何通过JS打开新窗体
    windows.open()关闭子窗体后刷新父窗体。
    这个可以在父窗体上加个隐藏的按钮按钮的事件是刷新本页面
    当关闭子窗体后触发父窗体的这个按钮事件
      

  2.   

    js打开新窗体,关闭父窗体        Response.Write("<script>javascript:window.open('default.aspx','newwindow','');window.opener =null;window.open('','_self','');window.close();</script>");
      

  3.   

    Response.Write("<script>javascript:window.open('default.aspx','newwindow','');window.opener =null;window.open('','_self','');window.close();</script>");
      

  4.   

    Response.Write(" <script>javascript:window.open('default.aspx','newwindow','');window.opener =null;window.open('','_self','');window.close(); </script>");
      

  5.   

    搂主标题写错了,你们看一下他的帖子内容 “父窗体被锁定” 而不是关闭父窗口。
    1楼的提议可以达到这个效果再给个url
    http://msdn.microsoft.com/zh-cn/library/ms536759(en-us,VS.85).aspx
      

  6.   

    window.showModalDialog();
    window.location.reload();
    这样好象可以了。
      

  7.   

    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页面中加入这句话就行了
      

  8.   

    打开
    window.showModalDialog(url);
    关闭刷新
    window.dialogArguments.location.reload();
      

  9.   

    如何通过JS打开新窗体,父窗体被锁定,关闭子窗体后刷新父窗体。打开新窗口..用window.showModalDialog和window.open
    父窗体被锁定:就用模式窗口window.showModalDialog
    子窗体后刷新父窗体:
    parent.window.location.reload();
    或是
    parent.window.location.href="父窗口地址";//重新指一下父窗口地址
      

  10.   

    window.showModalDialog();
    是可以實現鎖定父頁面,但是父頁面一片空白,我要實現的是鎖定父頁面,但是可以看的到父頁面的資料
      

  11.   

    看看测试..照着新建两个页面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>
      

  12.   

    Response.Write("<script>window.showModalDialog('../framselect/framselect.aspx?&quedatesheets=" + datesheets + "','','dialogwidth:545px;dialogheight:440px;help:no');</script>");
    我的父頁面是框架的形式
    子頁面只是單獨的一個webfrom
      

  13.   

    正常使用是不会出现空白的..出现空白是因为你用Response.Write(" ")打出来的..因为Response.Write是在服务器端执行的..会写在客户端HTML页面的最顶上..你是不是用Response.End();了..用了就会空白
      

  14.   

    那你就是說我要用JS寫到HTML裏面咯;
      

  15.   

    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>看看你是不是这个意思..
      

  16.   

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm9.aspx.cs" Inherits="WebApplication3.WebForm9" %>
    webform8.aspx和webform9.aspx最上面的东东没有加上..意思你应该能看懂..