Jump to content

IFRAME question


aviatorisu

Recommended Posts

I'm not quite sure how to ask this, but I'll give it my best.

Located on the front page of my homepage is an IFRAME.  When the page initally loads up, it displays a default page welcoming people.  Based on what button a user selects, a new section page is generated within the IFRAME.  Is there a way to load the page (through a link for example) to force the home page to load with one of the section pages instead of the default welcome?  This way, users can go directly to the start of one section without having to read the welcome over and over again.

Thanks,

~Z~
Link to comment
Share on other sites

Not so much change the default source...think of it this way:

I have a menu bar that, ideally, I'd like to be able to reload the homepage, but to a specific frame that perhaps the user has already visited.  It's such a pain for them to have to go through 1 or 2 other frames to get back to the one they were using previously.  Does that make more sense?  I guess simplified, is there a way to directly target (through the use of a link) a frame that perhaps would take 1 or 2 steps to navigate to normally?

~Z~
Link to comment
Share on other sites

Okay, perhaps a layout description would help.

1) The user starts on the home page, which has an IFRAME within it.
2) The user can make click a link which will change the page within the IFRAME, welcoming him to the section.
3) The new page within the IFRAME has a link within it that opens a search form within the IFRAME.
4) When the search is run, the PARENT becomes the target and the whole page changes to display results.

The question is, I would like to know if it is possible to place a link on the results page in step 4 to take the user to where he already is in step 3.  Does that make more sense?

Thanks,

~Z~
Link to comment
Share on other sites

Yes, it's possible.

This example may shed a bit of light to give you the gist of it:

[b]index.html[/b]
[code]<html>
<body>

This is my home page.<br />
<a href="page1.html" target="frame1">Page 1</a> | <a href="page2.html" target="frame1">Page 2</a><br /><br />

<iframe name="frame1" width="500" height="500" src="page1.html">
You browser doesn't support iFrames!
</iframe>

</body>
</html>[/code]

[b]page1.html[/b]:
[code]<html>
<body>

This is page 1!<br />
- <a href="http://www.google.com/" target="_parent">Go to google!</a> -

</body>
</html>[/code]

[b]page2.html[/b]:
[code]<html>
<body>

Your now on page 2!<br />
- <a href="http://www.yahoo.com/" target="_parent">Visit yahoo!</a> -

</body>
</html>[/code]

Also, you could add [b]<base target="frame1" />[/b] in the <head> section and it will make all links default to that frame.

From [url=http://w3schools.com]w3schools[/url], the target attributes are:
[quote]    *  _blank - all the links will open in new windows
    * _self - all the links will open in the same frame they where clicked
    * _parent - all the links will open in the parent frameset
    * _top - all the links will open in the full body of the window[/quote]
Link to comment
Share on other sites

Okay, I'm not sure I am still being clear, I hate when that happens, lol.  Please proceed to the following site for the example of what I am talking about:

[url=http://www.aviationhistoryonline.com]http://www.aviationhistoryonline.com[/url]

Now, when this homepage loads, you will see where the IFRAME is.  Click on the AIRCRAFT button to the left.  This will load a welcome page into the IFRAME with a link at the button.  Click the 'search' link to load a form into the IFRAME, and run a quick search.  This has now reloaded the entire page, and is now displaying all the results from the search.  Now, is it possible to have a link on this results page that will take you back to the home page, but with the search form loaded into the IFRAME?

~Z~
Link to comment
Share on other sites

Yes, though the homepage would need to know that it has to show the search iframe. This would probably be best done by having a GET statement on the homepage read with php.

Maybe have the link on that results page as "index.php&page=search", then on index.php inside the src iframe attribute have src="<?php if ($_GET['page'] == "search") { echo "search.php"; } else { echo "default.php"; }?>".
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.