Results 1 to 1 of 1
Show page from iFrame url in parent window Forum: HTML ForumReplies: 1
Link to top of parent document Forum: HTML ForumReplies: 0
08-06-2009, 04:17 AM #1
Passing value from iframe to parent
I have a parent page containing an iframe. The parent page has a menu in it which opens links in the iframe. I want to highlight different bits of the menu according to which page has loaded in the iframe.
So I would like to do something like this:
1. Use PHP to extract the file name (minus 'php' at the end, of the page loaded within the iframe (which I can do fine).
3. The parent page, having received that variable into its header, will adjust a line of css to something like:
And so the menu link for pagename.php will be colored red
4. When pagename1.php is loaded into the iframe, that will send 'pagename1' to the parent page, change the CSS in the head, and therefore change the highlighted menu item from pagename to pagename1
Is this possible? And easy? There seems to be a lot of stuff online about moving variables from iframes, but mainly in the context of form entries from an iframe to a parent.
parent.function_name(); seems to be needed along the way. But I am not sure how to proceed.