You are here: irt.org | FAQ | JavaScript | Frame | Q380 [ previous next ]
Try:
<frameset rows="50%,*"> <frame src="aFrame.htm" name="aFrame"> <frame src="bFrame.htm" name="bFrame"> </frameset>
In aFrame.htm:
<script language="JavaScript"><!-- function someFunction() { alert('Hello World') } //--></script>
In bFrame.htm:
<script language="JavaScript"><!-- function find(what) { for (var i=0;i<parent.frames.length;i++) { if (parent.frames[i].name == what) return true; } return false; } //--></script> <form> <input type="button" value="Test" onClick="if (find('aFrame')) parent.aFrame.someFunction()"> </form>