variable from another frame/page

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Alex Hunter

    variable from another frame/page

    Is it possible for one page to access a variable (or text) from another page
    or frame? How is this done?

    I want to update a piece of data on one page, and have it update on lots of
    different pages. I thought I could define the data as a variable on one
    page, and have all the other pages look at and display the variable from that
    page. Both pages could be open in a frameset. I have no idea how to do this,
    Is it possible? Could a javascript access a text file on the server and post
    this into a page? Any ideas?

    thanks,
    Alex Hunter

  • Lasse Reichstein Nielsen

    #2
    Re: variable from another frame/page

    Alex Hunter <alexhunter@att bi.com> writes:
    [color=blue]
    > Is it possible for one page to access a variable (or text) from another page
    > or frame?[/color]

    Yes, if you have a reference to the other page (or frame, but frames
    are easy to get a reference to if you are in the same window).
    [color=blue]
    > How is this done?[/color]

    Try reading this:
    <URL:http://www.infimum.dk/HTML/JSwindows.html# ref_2_6>
    I hope it is informative enough.
    [color=blue]
    > Both pages could be open in a frameset. I have no idea how to do this,[/color]

    Having two frames, or accessing data across them?
    [color=blue]
    > Is it possible?[/color]

    Absolutely.
    [color=blue]
    > Could a javascript access a text file on the server and post
    > this into a page? Any ideas?[/color]

    That is harder. Not all browsers have an easy way to access an
    arbitrary file on the server. One solution is to load the file into a
    hidden iframe and then use DOM methods to extract the text.

    /L
    --
    Lasse Reichstein Nielsen - lrn@hotpop.com
    Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    • Alex Hunter

      #3
      Re: variable from another frame/page

      thanks for the informitave link. I've got it somewhat, but I am still having
      some problems.

      I made a test page with two frames. The top frame defines three variables,
      and the botom frame retrives these variables from the other frame and
      displays them. here is the test page:


      It works sometimes, but other times the variables show up as "undefined" on
      the bottom frame. reloading the page cycles it between working and not
      working. Does anyone have any ideas why it would only work sometimes? I
      have tested on Mac OS X with IE and netscape.

      any feedback would be apreciated.

      thanks,
      Alex Hunter




      On Wed, 15 Oct 2003 18:21:41 -0400, Lasse Reichstein Nielsen wrote
      (in message <3cduqgzu.fsf@h otpop.com>):
      [color=blue]
      > Alex Hunter <alexhunter@att bi.com> writes:
      >[color=green]
      >> Is it possible for one page to access a variable (or text) from another
      >> page
      >> or frame?[/color]
      >
      > Yes, if you have a reference to the other page (or frame, but frames
      > are easy to get a reference to if you are in the same window).
      >[color=green]
      >> How is this done?[/color]
      >
      > Try reading this:
      > <URL:http://www.infimum.dk/HTML/JSwindows.html# ref_2_6>
      > I hope it is informative enough.
      >[color=green]
      >> Both pages could be open in a frameset. I have no idea how to do this,[/color]
      >
      > Having two frames, or accessing data across them?
      >[color=green]
      >> Is it possible?[/color]
      >
      > Absolutely.
      >[color=green]
      >> Could a javascript access a text file on the server and post
      >> this into a page? Any ideas?[/color]
      >
      > That is harder. Not all browsers have an easy way to access an
      > arbitrary file on the server. One solution is to load the file into a
      > hidden iframe and then use DOM methods to extract the text.
      >
      > /L
      >[/color]


      Comment

      Working...