0

How to call and running function javascript in frame one from other frame. This is my script :

My main code:

<frameset id="tes" rows="60,*">
    <frame id="frame2" src="../oneframe.php" frameborder="0" allowtransparency="true" marginwidth="0" marginright="0"></frame>
    <frame id="frame1" src="../twoframe.php" frameborder="0"></frame>
</frameset>

oneframe.php :

<button type="button" onClick="runFunc()">Running</button>

twoframe.php:

<html>
  <head>
     <title>tes</title>
      <script>
         function runFunc() {
            var x = document.getElementById('target');
            if (x.style.display === 'none') {
              x.style.display = 'block';
            } else {
              x.style.display = 'none';
            }
          }
      </script>
  </head>
  <body>
    <div id="target">This is my target</div>
  </body
</html>

Anyone can help me ?

dat3450
  • 954
  • 3
  • 13
  • 27
andan
  • 13
  • 2
  • You should be aware of this: `` - ***Deprecated** This feature has been removed from the Web standards. Though some browsers may still support it, it is in the process of being dropped. Avoid using it and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.* - https://developer.mozilla.org/en/docs/Web/HTML/Element/frameset – Jaromanda X May 24 '17 at 03:39
  • Note: there is no browser compatibility table in that page - a sure sign that using `` is dead – Jaromanda X May 24 '17 at 03:40
  • Some answers can be found in [Sharing global javascript variable of a page with an iframe within that page](https://stackoverflow.com/questions/7647042/sharing-global-javascript-variable-of-a-page-with-an-iframe-within-that-page) and [How to save Javascript variable between frames?](https://stackoverflow.com/questions/15009722/how-to-save-javascript-variable-between-frames) – CodeMonkey May 24 '17 at 03:42

0 Answers0