我用window.showModalDialog() 打开一个A.aspx页面,A页面上嵌着几个iframe B.aspx,C.aspx,D.aspx,E.aspx 如下源码:  <asp:Panel class="tagContent  selectTag" style="height:auto;" id="tagContent0" runat="server" Width="100%"> 
              <iframe id="mainFrame0" frameborder="0"  height="600"   name="mainFrame0" scrolling="no"
                      src="B.aspx?mode=<%=Request.QueryString["mode"] %>&id=<%=Request.QueryString["id"] %>&pid=<%=Request.QueryString["pid"] %>" width="100%"></iframe>
              </asp:Panel>
              <asp:Panel class="tagContent" id="tagContent1" style="height:auto;" runat="server" Width="100%"> 
                  <iframe id="mainFrame1" frameborder="0" height="600" name="mainFrame1" scrolling="auto"
                      src="C.aspx?mode=<%=Request.QueryString["mode"] %>&id=<%=Request.QueryString["id"] %>&from=fitting" width="100%"></iframe>
              </asp:Panel>
              <asp:Panel class="tagContent" id="tagContent2" style="height:auto;" runat="server" Width="100%"> 
                  <iframe id="mainFrame2" frameborder="0" height="600" name="mainFrame2" scrolling="auto"
                      src="D.aspx?mode=<%=Request.QueryString["mode"] %>&id=<%=Request.QueryString["id"] %>" width="100%"></iframe>
              </asp:Panel>
              <asp:Panel class="tagContent" id="tagContent3" style="height:auto;" runat="server" Width="100%"> 
                  <iframe id="mainFrame3" frameborder="0"  height="600" name="mainFrame3" scrolling="auto"
                      src="E.aspx?mode=<%=Request.QueryString["mode"] %>&id=<%=Request.QueryString["id"] %>" width="100%"></iframe>
              </asp:Panel>
我现在的问题是,我要在A.aspx里的第一个iframe里就是B.aspx的一个按钮事件要改变父页面A.aspx的参数,就是让A.aspx重新刷新,以便B.aspx,C.aspx,D.aspx,E.aspx重新获取参数我现在的代码是:string script = @";parent.location.href='/'+parent.location.pathname +'?mode=edit&id=" + this.F_PK_FITTING_ID.Text   + "&pid=" + Request.Params.Get("pid") + "';";
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", script, true);
这样有一个问题是它自己会打开一个新的窗口,我要的是还是在模态窗口里打开。请问各位有没有好的解决方案(: 解决后结帐备注:以前不用window.showModalDialog()打开时是正确的。

解决方案 »

  1.   

    showModalDialog 不能用 parent
      

  2.   

    在被showModalDialog 打开的页 用 window.dialogArguments 来获得
    showModalDialog 方法的第二个参数 ,可以用this 来把当前窗体对象传过去.
    在被showModalDialog 打开的也就可以用showModalDialog  来获得前一窗体的引用了
      

  3.   

    在A.aspx里加上 <base target="_self">
      

  4.   


    window.dialogArguments 是得到用showModalDialog 的父页面,而不是我打开的的那个页面(:
      

  5.   

    如果楼主的按钮事件里不做其他处理仅仅是为了改变IFRAME的URL参数
    更好的的办法是在客户端用脚本去改变各URL的参数,不要回服务器端处理
      

  6.   

    按钮里有一个保存事件是不是showModalDialog 里不能用parent ?
      

  7.   


    sorry~ 看差了  原来你要刷新showModalDialog 打开的页<head></head>中加上<base   target="_self"> 不行么?
      

  8.   

    parent.location.href 这个都可以得到A.aspx的地址,就是不知道为什么会在新窗口里打开
      

  9.   

    帮你找了一个,你试试showModalDialog页面刷新
    将以下内容添加到页面的<head></head>标签内,即可实现showModalDialog的页面刷新和IE"后退"按钮无效功能。 <meta http-equiv="Pragma" content="no-cache">
    <!-- Pragma content set to no-cache tells the browser not to cache the page
    This may or may not work in IE --> <meta http-equiv="expires" content="0">
    <!-- Setting the page to expire at 0 means the page is immediately expired
    Any vales less then one will set the page to expire some time in past and
    not be cached. This may not work with Navigator --> 
      

  10.   

    内容引自
    http://xiajx.spaces.live.com/blog/cns!11f54dd21fcd88ab!132.entry
      

  11.   

    要是还不行,那你就在A.aspx中在套一个iframe 那个iframe里包括那就个子iframe
    B.aspx,C.aspx,D.aspx,E.aspx 什么的
      

  12.   

    <frameset cols="167,*">
    <frame name="contents" target="main" src="left.aspx" marginwidth="1"  marginheight="1" scrolling="yes">
    <frame name="main" src="Op.aspx" scrolling="auto" >
    </frameset>
    例如框架是这样的 话。那你就在left这个页面加上 
    <head id="Head1" runat="server">
         <base target="main" />main是右边的frame起得名字
    </head>
      

  13.   

    parent.location.href这个值是可以得到的,一旦重新赋值就会打新的窗口,而不是在原来的窗口打开
      

  14.   

    还没有解决,准备换成window.open
      

  15.   

    哦~要是 非要showModalDialog打开的页 刷新
    就考虑在showModalDialog打开的页内加 iframe ,iframe 为目标页.刷新iframe
      

  16.   

    showModalDialog 打开的页面本来就是有iframe ,晕贴子里写的很清楚嘛
      

  17.   

    window.dialogArguments.location.href='页面';
      

  18.   

    window.showModalDialog()不要直接打开A.aspx。
    新建一个页面new.aspx,在new.aspx中放一个iframe,其src指为A.aspx
    这样就不会再打开新的页面了。
      

  19.   

    把a也套在一个iframe内,用一个html页面包一下就可以了,弹出的问题是,刷新时,重新生成了a