1
<frameset name="main">
 <frame src="leftnav.php" name="leftframe"/>
 <frame  src="dashboard.php" name="rightframe" bgcolor="#000000"/>
</frameset>

Hey. I want to execute some JavaScript in the rightframe and that should then affect in the left frame.

I guess the question is... what do I need to prefix my javascript with so it is accessible in the left frame?

ComputerUser
  • 4,828
  • 15
  • 58
  • 71

4 Answers4

3

If you are in a page wich is in the right frame and you want to access an element in a page in the left frame you can use for example:

var table=parent.leftframe.document.getElementById("information");
1

You can: parent.leftframe.var_name and parent.leftframe.function_name()

pinichi
  • 2,199
  • 15
  • 17
1

In a comment to the original question (above), @Valentin mentions that frames are "bad," but does not explain further. Here are some references that do:

https://softwareengineering.stackexchange.com/q/144515/290869

Frames deprecated in HTML5 but not iFrames

Why are frames deprecated in html?

CODE-REaD
  • 2,819
  • 3
  • 33
  • 60
0

index.html:

...
<script type="text/javascript">
    function hello () {
        alert('Say hello!');
    }
</script>
<frameset name="main">
 <frame src="frame1.html" name="leftframe"/>
</frameset>
...

frame1.html

...
<script type="text/javascript">
    parent.hello(); // OR parent.YOU_FRAME_NAME
</script>
...
beshkenadze
  • 646
  • 5
  • 12