Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IFRAME and Javascript Variables

Status
Not open for further replies.

plotzer

Programmer
Aug 28, 2001
35
0
0
US
I have a simple html page with an iframe in it. I would like the html page loaded in the iframe to have access to javascript variables in the main html page. SInce the main page is not frame, I am not sure how to do this. I am not sure what the syntax in the iframe page would be for accessing a variable in the parent page.

Let me know if you have any solutions.

thanks
 
I think I've found a 'simple' solution to my own problem:

parent.variablename seems to work for me. Let me know if there is a more elegant way than this as I am a DHTML/HTML newbie
 
That is the correct way as the parent for the page contained in the iframe is the page which contains the iframe

check out the following thread which gives info on interacting with frames

faq216-931

regards
ian

Infinity exists! - I just haven't worked out a way to get there yet.

| |
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top