0

Firefox 20.0.1 と IE 10.0.9200.16442 では動作しますが、どちらの入力要素も Chrome 26.0.1410.64 m では動作しません。

Chrome コンソールはこれを示しました:

キャッチされていない TypeError: オブジェクト [オブジェクト グローバル] のプロパティ 'say' は関数ではありません

========================main.html=======================

function say() { 
    alert("parent.html------>I'm at parent.html"); 
} 

function callChild() 
{ 
    var ifrm = document.getElementById("myFrame");
    ifrm.contentWindow.say();
} 

< input type=button value="invoke say() in the child.html" onclick="callChild()" /> 

< iframe id="myFrame" name="myFrame" src="child.html" />

========================child.html=======================

function say() 
{
    alert("child.html--->I'm at child.html"); 
} 

function callParent() {
    window.parent.say();
}

< input type=button value="invoke function say() in the parent.html" onclick="callParent()" /> 
4

1 に答える 1