How to initiate a JavaScript function in an iframe to run in the parent page? -
i have function in parent file depends on several global variables. having child iframe update 1 of parent's global variables with
parent.myvar = "myvalue"; works great (note: on same domain). need run function in parent complete process. problem:
parent.myfunction(); i have run function need minus of global variables in parent file (it being executed within child iframe). of course, bring on global variables parent file redeclaring global variables (i have parent function redeclairing). however, hoping more elegant solution. there way child initiate function run within parent environment?
i'm not sure if understand question, couldn't pass in variable reference of parent child?
like
var parentref = this; so child run
parentref.myfunction();
Comments
Post a Comment