javascript - document.getElementById("myFrame").contentWindow.myFrameFunction() won't work in Chrome 26.0.1410.64 m -


it works in firefox 20.0.1 , ie 10.0.9200.16442, both input elements won't work in chrome 26.0.1410.64 m

chrome console showed this:

uncaught typeerror: property 'say' of object [object global] not function

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

function say() {      alert("parent.html------>i'm @ parent.html");  }   function callchild()  {      var ifrm = document.getelementbyid("myframe");     ifrm.contentwindow.say(); }   < input type=button value="invoke say() in child.html" onclick="callchild()" />   < iframe id="myframe" name="myframe" src="child.html" /> 

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

function say()  {     alert("child.html--->i'm @ child.html");  }   function callparent() {     window.parent.say(); }  < input type=button value="invoke function say() in parent.html" onclick="callparent()" />  

my prototype bla bla wrong, see difference when called iframe

function callparent() {     console.log(window.say); //childs.say function     console.log(top.say); //parents.say function     console.log(self.say, this.parent.say); //more fun!     //window.parent.say(); } 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -