Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Passing value from iframe to parent
Old 08-04-2009, 11:38 AM Passing value from iframe to parent
Skilled Talker

Posts: 81
Trades: 0
Hi folks

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).
2. Use javascript onload so that the iframe sends this value (say 'pagename') to the parent page when it loads any page in the iframe.
3. The parent page, having received that variable into its header, will adjust a line of css to something like:
<style>.pagename {background-color:red;}</style>
4. And so the menu link for pagename.php will be colored red
5. 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 varaibles from iframes, but mainly in the context of form entries from an iframe to a parent, eg here:

http://www.highdots.com/forums/javas...me-225499.html

http://www.webdeveloper.com/forum/sh...ad.php?t=32435

parent.function_name(); seems to be needed along the way. But I am not sure how to proceed.

Grateful thanks

Tony
__________________

Please login or register to view this content. Registration is FREE
soon is offline
Reply With Quote
View Public Profile Visit soon's homepage!
 
 
Register now for full access!
Old 08-04-2009, 10:02 PM Re: Passing value from iframe to parent
Junior Talker

Posts: 1
Name: lelananh
Trades: 0
Life is too short to be serious, laugh it up.



gratuit pour mobile sonnerie portable mp3 - Sonnerie portable MP3 est en effet un pouvoir de l'innovation technologique. Ętes-vous familier avec cette sonnerie portable?gratuit pour mobile sonnerie portable mp3
lelananh is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Passing value from iframe to parent
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.30005 seconds with 12 queries