问个问题,
在父窗体有一个,
<input type="hidden" name="s" id="s" value="0"/>在这个窗体上弹出一个小子窗体,
并选择一个控件操作,
然后再确定,提交到本子窗体,
这时运行JS
<script>
window.parent.document.getElementById("s").value=s;

</script>这时提示错误:
window.parent.document.getElementById("")
是空或者NULL
这个该怎么解决?

解决方案 »

  1.   

    window.showModalDialog( url,window,...);
    如果是用模式对话框打开新窗口,可以这样
    在子窗口中
    var pWin = top.parent.dialogArguments;
            pWin.document.getElementById("");
      

  2.   

    看一下窗体是iframe 还是open出来的新窗口;要是新窗口的话window.opener.document.getElementById('id').value;
    要是iframe的话就用
    window.parent.document.getElementById('id').value;
      

  3.   

    楼主可以参考下http://blog.csdn.net/wangfan1207/article/details/7878459貌似在IE下可以,chrome下失效,firefox没有测试。
      

  4.   

    window.parent这个好像是用在iframe中的,子窗口访问父窗口的。
    如果是open或者showModalDialog开来的子窗口的话,就不是这样传值了。
      

  5.   

    window.open用window.opener;其他的一般用window.parent