Javascript document.getElementById(";myFrame";).contentWindow.myFrameFunction()赢得';t在铬合金26.0.1410.64 m中工作

Javascript document.getElementById(";myFrame";).contentWindow.myFrameFunction()赢得';t在铬合金26.0.1410.64 m中工作,javascript,dom,iframe,Javascript,Dom,Iframe,它适用于Firefox 20.0.1和IE 10.0.9200.16442,但这两种输入元素在Chrome 26.0.1410.64 m中都不起作用 Chrome控制台显示: 未捕获的TypeError:对象[object global]的属性“say”不是函数 =====================================main.html======================= function say() { alert("parent.html------&g

它适用于Firefox 20.0.1和IE 10.0.9200.16442,但这两种输入元素在Chrome 26.0.1410.64 m中都不起作用

Chrome控制台显示:

未捕获的TypeError:对象[object global]的属性“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" />
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()" /> 
函数say(){
警报(“parent.html----->我在parent.html”);
} 
函数callChild()
{ 
var ifrm=document.getElementById(“myFrame”);
ifrm.contentWindow.say();
}