0

I want to call func which in iframe , from parent. If the func is in parent I could call it like : parent.func(); but I want to call func which is in iframe and I want to call it from parent? js says I could not find func? How can I call it?

thanks

user3086226
  • 93
  • 1
  • 7
  • 18

2 Answers2

1

Try either

window.frames['childFrame'].func();

or

document.getElementById('childFrame').contentWindow.func();
Johan
  • 34,157
  • 52
  • 174
  • 280
1

You can do like this,

document.getElementById('frame').contentWindow.helloWorld();

Ref : How to call javascript function specified in a child <frame>

Community
  • 1
  • 1
Girish
  • 11,607
  • 3
  • 35
  • 49