0

I've a framed page, called main.xhtml. Inside that page is the following code block:

<html>
<body>
<script>
javascriptCode
</script>

<frameset cols="234,*" border="0" frameborder="no">
   <frame src="LeftPage.html"  />
   <frame src="RightPage.html" name="main" />
</frameset>

</body>
</html>

How can I call the javascriptCode from inside LeftPage.html or RightPage.html? For example, I'll click on a button on LeftPage.xhtml and javascriptCode in the main page will be triggered. Thanks.

Mike Samuel
  • 118,113
  • 30
  • 216
  • 245
mudcup
  • 151
  • 2
  • 7

1 Answers1

0
window.parent.fn()

calls the function fn defined as a global variable in the parent frame.

It works because, in the browser, window is the global object whose properties alias global variables, so window.parent points to another frame's global object so its properties are the globals for code loaded in that other frame.

Mike Samuel
  • 118,113
  • 30
  • 216
  • 245