View Full Version : Iframe set URL based on link clicked

09-29-2007, 01:59 AM
OK, hopefully I won't confuse you because I'm confused when I try to explain it to myself.

I have a calendar in /events/month.php which is shown in an iframe on events.php. On /events/month.php, when an event is on the calendar, the date can be clicked and it shows the info of, say, /events/view_entry.php?id=4&date=20070929

On index.php I have an iframe of /events/upcoming.php which shows the upcoming events and links to, say, /events/view_entry.php?id=4&date=20070929.

I'm wondering, is it possible to have the page change to events.php and show /events/view_entry.php?id=4&date=20070929 (or whatever link to the /events/ folder is clicked) in the iframe?

Your help will be appreciated. :)

09-29-2007, 02:49 AM
I'm lost. Sorry.

I think what you want can be accomplished with the target="framename" attribute.

using "_parent" on the iframe page will make it open in the whole window (clearing the iframe as well)
and using "iframename" on the main page will open in the iframe.

09-29-2007, 04:30 AM
Thanks for the quick reply.

What I meant to say was:

upcoming.php links to the calendar events and is in an iframe on index.php.
Is it possible for the links in upcoming.php to change from index.php to events.php and go to the correct page?

Let me know if I'm still not clear enough and I'll draw a diagram if need be.

09-29-2007, 04:34 AM
Is the question the TARGET FRAME or the URL that it goes to?

The URL can be changed in the PHP itself, probably, or, with way too much would you could change it with javascript, but that's just silly.

The Target Frame can be changed like I said in the last post.

I *think* what you are asking can be fixed using _parent.

Just use the target attribute:
<a href="?d=123" target="_parent">

Or, if you have more than one frame to worry about, _top will the outermost frame:
<a href="..." target="_top">