Reputation: 8332
Page A has iframe B. In iframe B, I have a var store a function name of page A. How to call that function from iframe B? (Both in a same domain)
I try this in iframe B
eval("window.parent." + func_name + "('"+param1+"', '"+param2+"');");
It work well but I ask for a better solution if possible.
Upvotes: 0
Views: 763
Reputation: 16752
To avoid the eval you can write:
window.parent[func_name](param1,param2)
Upvotes: 5