jQuery: it can do just about anything.
All you need is a simple script inside your iframe page, maybe something like:
$(document).ready(function() {
parent.top.$(div#menuID).css('background-color', 'red');
});I have tested this, but it might point you in the right direction.
Hi folks
I have a parent page containing an iframe. The parent page has a menu in it. 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, for the page within the iframe.
2. Use javascript onload so that the iframe sends this value (say 'pagename') to the parent page when it loads
3. The parent page, having received that variable into its header, will adjust a line of css thus:
.pagename {background-color:red;}
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? There seems to be a lot of stuff online about moving variables from iframes, but mainly in the context of form entries.
http://www.highdots.com/forums/javascript-discussi...
http://www.webdeveloper.com/forum/showthread.php?t...
parent.function_name(); seems to be needed along the way
seems to be more what I need!
Blessings and thanks
Tony
Online outreach:
Internet Evangelism Day
Helping church websites:
Church Websites