views:

16

answers:

1

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.

+2  A: 

To avoid the eval you can write:

window.parent[func_name](param1,param2)
Matthew Manela