Reputation: 562
I am trying to call a function inside an iFrame. Everythings fine with the code below when I'm using Firefox but if I use IE(8) it does not work:
document.getElementById("iframe").contentWindow.myFunction();
From the parent, I wanted to call the function inside the iFrame. How do I let it work in IE?
Thanks
Upvotes: 2
Views: 1388
Reputation: 562
I got it to work across all browsers with this code below:
window.frames['iframeid'].window.myFunction();
Upvotes: 0
Reputation: 5226
try
var _frame = document.getElementById("iframe");
var contentWin = _frame.contentWindow || _frame.contentDocument;
Upvotes: 1