weemikey Posted July 24, 2007 Share Posted July 24, 2007 Hi all! I posted in the php forum and was basically told that this is most likely a job for js. So here's what I'm doing.... I have an index.php page (basically all html) that holds an iframe. index.php has the menu structure and a static page header graphic. The menu items all call php logic that is displayed in my iframe. As an example, I have a page with a list of themes on it. If you click on a theme (all happening in the iframe) I need the theme NAME to be passed to index.php and displayed under the header graphic. So the iframe needs to "refresh" the parent and pass it ONE piece of data. I'm looking all over for an answer, but I don't know squat about javascript. I found an example of how to declare a js variable in php, so at least I know my script can create a var. I see lots of "document.get.....' examples, but as I said I don't know much about javascript. Any good ideas, or even good reference sites for how this could work? I have till tomorrow morning to make this work! Thanks a million! Mike Quote Link to comment Share on other sites More sharing options...
Karl33to Posted July 24, 2007 Share Posted July 24, 2007 if your not up to speed on javascript how about a simpler approach using just html and a bit of php, something like ... // index.php <html> <body> <img src="header.jpg" /><br /> <?=$_GET['theme_name'];?><br /> Menu<br/> <iframe src="iframe.html" name="frame"></iframe> </body> </html> // iframe.html <a href="index.php?theme_name=theme_1" target="_top">theme_1</a><br /> <a href="index.php?theme_name=theme_2" target="_top">theme_2</a><br /> <a href="index.php?theme_name=theme_3" target="_top">theme_3</a><br /> </code] Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted July 25, 2007 Share Posted July 25, 2007 Keep in mind that if an iframe refreshes it's container the iframe will itself be refreshed and likely take you back to the first page of the iframe. To prevent this, you would likely have to host the top and side bars in frames with borders turned off and have the content iframe refresh the menu and top iframes. I think you're better off accomplishing this first on the server-side with PHP as Karl33to suggested; any solution that requires Javascript is guaranteed to break as soon as someone browses your site with Javascript turned off. Quote Link to comment Share on other sites More sharing options...
mainewoods Posted July 29, 2007 Share Posted July 29, 2007 if you have a span in the parent page like this: <span id="themeName"></span> then from the iframe you should be able to execute this js: top.getElementById('themeName').innerHTML = '**new theme name**'; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.