框架页的代码 <frameset rows="50,*" cols="*" framespacing="0" frameborder="no" border="0">
     <frame src="top.jsp" name="topFrame" scrolling="No" noresize="noresize" id="topFrame" />
     <frameset rows="5,*" cols="*" framespacing="0" frameborder="no" border="0">
         <frame src="middle.jsp" name="middleFrame" scrolling="No" noresize="noresize" id="middleFrame" />
     <frameset rows="*" cols="180,*" framespacing="0" frameborder="NO">
  <frame src="IndexAction.do?method=getUserModules" name="leftFrame" id="leftFrame" scrolling="yes" noresize="noresize"/>
  <frameset rows="*" cols="5,*" framespacing="0" frameborder="NO"> 
  <frame src="leftSecond.jsp" name="leftSecFrame" id="leftSecFrame" scrolling="no"/>
 
  <frame src="activeList.jsp" name="mainFrame" id="mainFrame" />
  </frameset>
   </frameset>
   </frameset>
</frameset>现在在activeList.jsp中调用函数OpenWindow()打开activeEdit.jsp
 function OpenWindow( filter,title) {
        var pagestring = "activeEdit.jsp?key=" + filter;
        var windowconfig = "resizeable=no,toolbar=no,menubar=no,location=no,directories=no,status=yes,scrollbars=yes,,resizable=no,top=300,left=300,width=350,height=350";
        var doc = window.open(pagestring, title, windowconfig);
    }在activeEdit.jsp中接收参数并处理
var key = window.dialogArguments;
alert("您传递的参数为:" + key);
document.getElementById('key').value=key;当我点一按钮时执行winClose(),关闭activeEdit.jsp并刷新父窗口activeList.jsp..
但是window.parent.frames.mainFrame.location一直报错function winClose(){
alert('7close'+self.parent.frames+","+self.parent.frames["mainFrame"]);
window.parent.frames.mainFrame.location.reload();

window.close(); 
}

解决方案 »

  1.   

    window.parent.frames["mainFrame"].src=window.parent.frames["mainFrame"].src;
    试试
      

  2.   

    你也可以尝试在mainFrame这个框架中的页面里写一个JavaScript function然后你可以在其他的页面中调用
    window.parent.frames.mainFrame.xxx();
      

  3.   


    不可以。
    报window.parent.frames.mainFrame为空或不是对象错误
      

  4.   

    window.parent.document.getElementById("mainFrame").src=window.parent.document.getElementById("mainFrame").src;
    呢?
      

  5.   


    不行。。
    window.parent.document.getElementById(...) 为空或不是对象
      

  6.   

    window.frames["mainFrame"]  请先指定iframe的name和id属性  name和id最好一样
     iframe一般调用的两种用法:第1种
    document.getElementById(“ifr”);
    第2种
    window.frames[“ifr”];
    要想使用iframe内的函数,变量就必须通过第二种方法.因为它取的是一个完整的DOM模型(不知道这样说对不对).第一种方法只是取出了一个OBJECT而已.如果只想改变iframe的 src 或者 border , scrolling 等 attributes(与property不是一个概念,property是不能写在标签内的,比如:scrollHeight,innerHTML等),就需要用到第一种方法.如果想取得iframe的页面(不是iframe本身),就需要使用第二种方法,因为它取得的是一个完整的DOM模型,比如想得到iframe的document.body的内容,就只能用第二种方法.还要注意的是,如果在iframe的页面未完全装入的时候,调用iframe的DOM模型,会发生很严重的错误,所以,你要准备一个容错模式.
      

  7.   

    现在在activeEdit.jsp中调用alert(window.parent.frames.mainFrame);显示undefined
      

  8.   

    找到问题的一部分原因了。
    我在activeEdit.jsp中写了个方法较open()
    [code=JScript]
    function open(key){
    window.showModalDialog("activeEdit.jsp",key,"dialogWidth=500px;dialogHeight=400px");
    }
     function OpenWindow( filter,title) {
            var pagestring = "activeEdit.jsp?key=" + filter;
            var windowconfig = "resizeable=no,toolbar=no,menubar=no,location=no,directories=no,status=yes,scrollbars=yes,,resizable=no,top=300,left=300,width=350,height=350";
            var doc = window.open(pagestring, title, windowconfig);
        }所以在执行OpenWindow函数时,会调用我自己定义的open方法,(一直纳闷在activeEdit.jsp页面接收父页面的参数怎么会使用window.dialogArguments,现在这个清楚了,改为var key="<%=request.getParameter("key")%>";)
    最后关闭的时候调用window.opener.location.reload();可以实现父页面的刷新。
    但奇怪为什么window.parent.frames.mainFrame是undefined
      

  9.   

    =.=
    原来你漏了个自定义的方法啊...因为modalDialog要用opener了...