Web Analytics Made Easy -
StatCounter Getting variables from iframes - CodingForum

Announcement

Collapse
No announcement yet.

Getting variables from iframes

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Getting variables from iframes

    Hi,

    I am trying to pull a variable from an iframe (b) to the page that contains it (a).

    Here is the code:
    (b)
    <script language="JavaScript">
    <!--
    var blahblah = 5;
    // -->
    </script>


    (a)
    <script>
    document.write(top.RSIFrame.blahblah);
    </script>


    I am getting the error "undefined"

    Thanks in advance

  • #2
    When do you want to access the variable? If you want to access it as the main page is loading, there will be a timing problem as the iframe page may not be completely loaded when the main page tries to access iframe page variable.
    Glenn
    vBulletin Mods That Rock!

    Comment


    • #3
      LOL! Glenn, I think you helped me on a problem like this, but with finding DIV heights inside an iFrame and posting them on the main page.

      I lost the code, but didn't it have a timeout sequence in it somewhere?
      <div> - putting your mind in a box since 1997

      Comment

      Working...
      X