You are here: irt.org | FAQ | JavaScript | Frame | Q1631 [ previous next ]
If you have two or more frames in a frameset, then the order and speed in which they load is unpredicatable, therefore if you invoke a function in one frame from another it is possible that the function will not have been defined by the time you invoke it. In which case you need to test to see if it is defined before you attempt to use it. If it isn't defined then you can use setTimeout to perform the test again after a delay:
<script language="JavaScript"><!-- function localFunction() { if (parent.otherFrameName.remoteFunction) { parent.otherFrameName.remoteFunction(); } else { setTimeout('localfunction()',500); } } //--></script>