2011-12-07 46 views
1

我已經看到了其他類似的問題,但我似乎仍然看不到它正確我在ASPX頁面上獲得了此JavaScript,但它在IE和Chrome中工作,但不是Firefox 。我也嘗試過FireBug插件,但它似乎沒有幫助。在Firefox中不工作的窗口之間傳遞值的JavaScript

<script language="javascript" type="text/javascript"> 
      function PassValues() { 
       window.opener.document.forms(0).submit(); 
       self.close(); 
      } 

回答

1
From SO itself: http://stackoverflow.com/questions/2678133/pass-a-value-from-parent-to-child-open-window 

設置使用window.open()方法的引用:

var childWin = window.open("www.google.com" <etc.>); 

Then treat childWin as a whole other window. For example, 

childWin.document.getElementById('searchField') 

會給你用 「searchField」 的ID的元素的引用。等清洗並重復。

1

您的問題是使用document.forms作爲可調用對象。根據規範,事實並非如此。嘗試window.opener.document.forms[0].submit()

相關問題