JavaScript的父母和孩子的窗口

问题描述:

我有一个页面,使用JavaScript并打开一个子窗口,更新父窗口中的一些字段。JavaScript的父母和孩子的窗口

现在已更新的领域有onchange()功能我想子窗口更新场时调用这个函数。

这是可能使用的JavaScript?

编辑:

我的代码:

这是打开的子窗口中的链接:

<a href="javascript:void(0);" style="width:100%; height:125%" onclick="window.open('otherExpenses.php','Ratting','width=350,height=550,left=50,top=50,toolbar=1,status=1,');">Open Child</a> 

而在子窗口中,某些操作与用户进行互动,那么这就是孩子是如何关闭:

<a href="javascript:void(0);" onclick="post_value()">Close Child</a> 

而且post_value()功能:

function post_value() 
{ 
    opener.document.overHeads.overheadOther.value = document.otherExpenses.TextBox27.value; 
    opener.document.overHeads.hiddenOther.value = document.otherExpenses.TextBox27.value; 
    //here I want to call a function from the parent window that updates some field in the parent window. 
    self.close(); 
} 

回答你的问题: “这是可能的使用JavaScript?”

你需要发布一些更多的代码,如果你想有一个更好的答案。

如果函数属于父窗口,你必须把它从父窗口的上下文连接到子窗口:

//w is the child window 
w.document.getElementById('theId').onchange(window.somefunction); 
+0

我已经添加代码到我的问题,希望它有助于理解我的问题。 – sikas 2011-01-06 22:29:44