window.opener.document无法工作在

时间:2016-05-16 08:23:18

标签: javascript jsp

我对Internet Explorer有一个奇怪的问题 我有一个由基页打开的弹出窗口。

parent.jsp

<script>
    function chkYMS(){           
         alert("setYMS:" + document.getElementById('setYMS').value); //setYMS:16.05.2015
         window.open(/common/popup.jsp, 'popFrm');
    }
</script>
<form name="frm" method="post">
    <input name="setYMS"  id="setYMS" type="text" class="inputbox_25" style="width: 135px;"/> 
    <img src="/common/images/icon/c.gif" onClick="chkYMS();" align="absmiddle">
</form>

popup.jsp

<SCRIPT language=JavaScript>
     var getYMS = "";
     //not working ie 8,9,10,11 : document is null or not an object (chrome is working)
     //getYMS = window.opener.document.forms['frm'].elements['setYMS'].value;
     //getYMS = window.opener.document.getElementById('setYMS').value;
     //getYMS = parent.opener.document.getElementById('setYMS').value; 
     //getYMS = window.opener.RceptTransYMS.value;


 </script>
 <form name="popFrm">
 </form>

我怎么能像素? 我不想使用window.showModalDialog() 你能帮忙吗?

1 个答案:

答案 0 :(得分:0)

尝试的解决方案选项很少:

  1. 在互联网选项的“安全”选项卡下,单击“可信网站”图标。现在选中标记为“启用保护模式”的复选框,然后重新启动Internet Explorer。 (请记住,有问题的网站是受信任的网站)

  2. 您也可以尝试这样的事情,

    ** var win = window.open(“”,“win”,“width = 200,height = 100”);

    win.document.write('这是弹出窗口!');

    win.focus();

    win.opener.document.write('这是源窗口!'); **

  3. window.opener是一个非标准属性,很少有浏览器不支持它。使用window.open(URL,name,specs,replace)是一个不错的选择。如果子窗口来自不同的域,window.opener将无法在默认安全级别的IE中工作。