Jump to content

iframe and parent, how can I "refresh" the parent


weemikey

Recommended Posts

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  ;D

Link to comment
Share on other sites

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]

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.