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
  • 35,120
  • 54
  • 178
  • 293
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,907
  • 3
  • 34
  • 51