本文介绍了window.opener在Firefox中为null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个打开弹出窗口的页面

  openWindow(top,'prcsTypeSelectionPopup?event = prcsTypeSelection','lovWindow ',{width:750,height:550},true,'dialog',pathCallBack); 

,弹出窗口有以下代码:

 函数returnSelect()
{
window.document.forms [0] .choice_processType.value;
window.opener.document.forms [0] .pevent.value ='getprocessName';
window.opener.document.forms [0] .processName.value ='';
for(var i = 0; i< document.forms [0] .elements.length; i ++)
{
if(document.forms [0] .elements [i]。已检查)
{
window.opener.document.forms [0] .processName.value = document.forms [0] .elements [i] .value;
break;

$ b $ if(window.opener.document.forms [0] .processName.value ==''){
window.opener.document.forms [0] .lovProcessType.value ='';
window.opener.document.forms [0] .pevent.value ='';

window.opener.document.forms [0] .submit();
closeConn();


函数closeConn()
{
self.close();
}

但是当页面在firefox中加载时,出现
window.opener在returnselect()函数的第二行是空的

$ p $函数returnSelect()
{
window.document.forms [0] .choice_processType.value;
- > window.opener.document.forms [0] .pevent.value ='getprocessName';

任何想法如何克服这个

在此先感谢...

解决方案

它只适用于parent.window.opener而不适用于window.opener



感谢Sergzach你的时间

I have a page which opens the popup as

openWindow(top, 'prcsTypeSelectionPopup?event=prcsTypeSelection', 'lovWindow', {width:750, height:550}, true, 'dialog', pathCallBack);

and the popup has the following code

function returnSelect()
{
    window.document.forms[0].choice_processType.value ;
    window.opener.document.forms[0].pevent.value = 'getprocessName';
    window.opener.document.forms[0].processName.value='';
    for (var i=0; i < document.forms[0].elements.length; i++)
   {
   if (document.forms[0].elements[i].checked)
      {
      window.opener.document.forms[0].processName.value=document.forms[0].elements[i].value;
      break;
      }
   }
   if(window.opener.document.forms[0].processName.value=='')    {
        window.opener.document.forms[0].lovProcessType.value = '';
        window.opener.document.forms[0].pevent.value = '';
   }
    window.opener.document.forms[0].submit();
    closeConn();
}

function closeConn()
{
         self.close();
}

But when the page is loaded in firefox, am getting the error aswindow.opener is null at the 2nd line of returnselect() function

function returnSelect()
    {
        window.document.forms[0].choice_processType.value ;
        --> window.opener.document.forms[0].pevent.value = 'getprocessName';

Any idea how to overcome this

Thanks in advance...

解决方案

it works only for "parent.window.opener" and not for "window.opener"

Thanks Sergzach for your time

这篇关于window.opener在Firefox中为null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 23:24