window.opener.document在ie中不起作用

window.opener.document not working in ie

本文关键字:不起作用 ie opener document window      更新时间:2023-09-26

我在使用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. 在internet选项的"安全"选项卡下,单击"受信任的网站"图标。现在选中标记为"启用保护模式"的复选框,然后重新启动internet explorer。(请记住,有问题的网站是一个值得信赖的网站)

  2. 你也可以试试这样的东西,

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

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

    win.focus();

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

  3. window.opener是一个非标准属性,很少有浏览器不支持它。使用window.open(URL、名称、规范、替换)是一个不错的选择。如果子窗口来自其他域,则window.opener在默认安全级别下无法在IE中工作。。