需要要注意的是其父页面是一个框架~
框架如下:<frameset rows="77,*,31" frameborder="no" border="0" framespacing="0" >
  <frame src="top.jsp" name="topFrame" scrolling="No" overflow-x:hidden noresize="noresize" id="topFrame" />
  <frame value="transparent" src="main.jsp" name="mainFrame" scrolling="auto" marginwidth="0" id="mainFrame" />
  <frame src="bottom.jsp" name="bottomFrame" scrolling="No" noresize="noresize" marginwidth="0" id="bottomFrame" />
</frameset>现在是点击main.jsp页面中的一个按钮通过open方法打开的页面 sub.jsp .
问题是如何在关闭sub.jsp页面之前局部刷新main.jsp中的元素 。
网上找了几种方法试了下如://方式一 不行
$('#insurant_list', window.parent.frames["mainFrame"].document).html(html);
//方式二 不行
$('#insurant_list', window.opener.document).html(html);
//方式三 也不行
$('#insurant_list', window.opener.frames["mainFrame"].document).html(html);请高手们指教~ 

解决方案 »

  1.   

    sub.jsp:
    <script>
    window.onbeforeunload=function(){
      opener.location.reload();
    }
    </script>
      

  2.   

    http://tlhl28.is-programmer.com/posts/14376.html
      

  3.   


    就是用ajax局部刷新的啊~  
    现在问题就是要刷新他的 父页面 啊 
    但是无论我用window.opener 还是window.parent 都不行~
      

  4.   

    var o=top.frames[1]||top.frames[1].contentWindow;//兼容
    var doc=o.document;
    $('#insurant_list', doc).html(html);
      

  5.   

    直接reload多好 干嘛非要jquery呢?
      

  6.   

    var d= window.parent.frames["mainFrame"].document
    var list=d.getElementById('insurant_list');
    list.inerHTML=html;你这样执行 看看错在哪里 
    找出错的原因 就能解决了
      

  7.   

    提示 window.parent.frames["mainFrame"].document 这个对象是空的~ 或不是对象~!
      

  8.   


    这样则报 undefined错啦~
      

  9.   

    通过window.opener.document 可以获取 text控件的值 却获取不到元素<tbody id="insurant_list">的值是为什么?
      

  10.   

    main.jsp页面里用showmodeldialog方法打开sub.jsp 就可以了,关闭sub.jsp时回传参数给main.jsp。
      

  11.   

    终于知道为什么了 ,原来是因为IE对html元素的检测很严格 ~
    如果我给tbody 加内容 如果直接加字符串如“aaaa”,IE是不会显示出来的 ,
    只有将字符串改成"<tr><td>aaaa</td></tr>"这样才可以出来 。
    火狐则没有这么严格不过会报错 ~ 
    我一直在找怎么样拿到父页面的对象 ,其实通过“window.opener.document”
    就可以取到open方法打开的父页面对象啦 ~
    总结这次教训,要解决一个问题必须有条序,不要被表面情况所蒙蔽了,先找出
    解决问题的方法 然后一步一步进行排查 。