variable from another frame/page

A

Alex Hunter

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
 
L

Lasse Reichstein Nielsen

Alex Hunter said:
Is it possible for one page to access a variable (or text) from another page
or frame?

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).
How is this done?

Try reading this:
Both pages could be open in a frameset. I have no idea how to do this,

Having two frames, or accessing data across them?
Is it possible?
Absolutely.

Could a javascript access a text file on the server and post
this into a page? Any ideas?

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
 
A

Alex Hunter

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:
http://alex.hunter.home.comcast.net/test

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top