swapping iframes within same page

R

richard

I'm thinking of a simple 2 division page on which the top division is a
menu.
The 2nd division is an iframe which changes depending on the menu choice.
I know there is a way to do it and hopefully without javascript.
Just need to brush up on how to do it properly. Who's got a sample for me?
 
P

patrick j

I'm thinking of a simple 2 division page on which the top division is a
menu.
The 2nd division is an iframe which changes depending on the menu choice.
I know there is a way to do it and hopefully without javascript.
Just need to brush up on how to do it properly. Who's got a sample for me?

It's very easy to do.

However i|Frames and indeed Frames in general are considered to be
rather old school these days.

All you do is give the iFrame a name in the iFrame element, then when
you link to the file to "supply" the iFrame put the iFrame's name as
the target.

Here's the lnk:

<a href="thelinkedfile.html" target="nameofiframe">linked text</a>

So obviously you have one of these links for each of the files you are
planning on having as a possibility to fill the iFrame.

And now the iFrame:

<iframe src="defaultiframesupplyfile.html" name="nameofiframe"
width="500" height="500" frameborder="0"></iframe>

In the iFrame you'll see "defaultiframesupplyfile.html", this is to be
the path and filename of the file which fills the iFrame when no link
has been clicked. You'll see frameboard="0" this can be set to 0 or 1.
This is to turn off or on the iFrame boarder. It is more often turned
off these days.
 
J

Jonathan N. Little

richard said:
I'm thinking of a simple 2 division page on which the top division is a
menu.
The 2nd division is an iframe which changes depending on the menu choice.
I know there is a way to do it and hopefully without javascript.
Just need to brush up on how to do it properly. Who's got a sample for me?

Since you are generating you page server-side I cannot understand why
you would need to include with an IFRAME.
 
R

richard

Jonathan N. Little said:
Since you are generating you page server-side I cannot understand why you
would need to include with an IFRAME.

2,000 plus files as a possibility to be selected would be more easily
accomplished in an iframe.
Saving to have needlessly repeat the menu on every page.
 
R

richard

patrick j said:
It's very easy to do.

However i|Frames and indeed Frames in general are considered to be
rather old school these days.

All you do is give the iFrame a name in the iFrame element, then when
you link to the file to "supply" the iFrame put the iFrame's name as
the target.

Here's the lnk:

<a href="thelinkedfile.html" target="nameofiframe">linked text</a>

So obviously you have one of these links for each of the files you are
planning on having as a possibility to fill the iFrame.

And now the iFrame:

<iframe src="defaultiframesupplyfile.html" name="nameofiframe"
width="500" height="500" frameborder="0"></iframe>

In the iFrame you'll see "defaultiframesupplyfile.html", this is to be
the path and filename of the file which fills the iFrame when no link
has been clicked. You'll see frameboard="0" this can be set to 0 or 1.
This is to turn off or on the iFrame boarder. It is more often turned
off these days.

Ok. But assume I have 10 possible choices. Do I just use the <iframe src>
tag within a division for each of the choices? Changing the name
accordingly?
 
P

patrick j

Ok. But assume I have 10 possible choices. Do I just use the <iframe src>
tag within a division for each of the choices? Changing the name
accordingly?

No, the href in the link sends that page to the iframe.

All the src in the iframe element does is tell what the iframe will
display if no link has been clicked.

If you want to look at an example of it, I use them at my web-site (but
don't tell anybody).

Here:

<http://www.patrickjames.me.uk/clubpromotion/gallery.html>

the thumbnail links open images in an iframe below the links. Each jpg
is kept in an html "wrapper" so when you click on the thumbnail in fact
you are clicking on a link to that html "wrapper" to fill the iFrame
below.

Here:

<http://www.patrickjames.me.uk/cv/cv.html>

the timeline is an imagemap containing links to an iframe below the
imagemap.

Here:

<http://www.patrickjames.me.uk/music/music.html>

there are two iframes. The one on the left has links which direct the
content for the one on the right.

In each case it is the same, each iframe has an src which fills the
iframe with a "default" content which is displayed if nothing is
clicked, most notably when you first come to the page.

Then once you click on one of the links, the href in the link tells the
iframe what to display.

The link knows where to send the href because you have the target in
the link set to the name of the iframe.
 
R

richard

richard said:
I'm thinking of a simple 2 division page on which the top division is a
menu.
The 2nd division is an iframe which changes depending on the menu choice.
I know there is a way to do it and hopefully without javascript.
Just need to brush up on how to do it properly. Who's got a sample for me?

http://www.samisite.com/test-csb2nf/id43.htm

This page shows exactly what I want to do but the page source is riddled
with JS and a ton of other garbage it's hard to understand how to do it
properly.

Trying to find simple coding is like looking for a needle in a haystack.
I'd like a simpler practical example if possible.
 
R

richard

richard said:
I'm thinking of a simple 2 division page on which the top division is a
menu.
The 2nd division is an iframe which changes depending on the menu choice.
I know there is a way to do it and hopefully without javascript.
Just need to brush up on how to do it properly. Who's got a sample for me?

Ok so I got it all sorted out and all is working fine so far.
 
H

Harlan Messinger

richard said:
2,000 plus files as a possibility to be selected would be more easily
accomplished in an iframe.
Saving to have needlessly repeat the menu on every page.

It isn't needless, it's the better way to do it. Among reasons why:

1. Otherwise, people won't be able to bookmark your pages or send links
to them to other people.

2. Search engines will either ignore your site, they'll display links to
the material that goes into the IFRAMEs, which means that anyone who
comes to your site via the search engine won't see your navigation.

But you define the common code on every page. You put it in a separate
file and #include it on each page with the following one-line directive:

<!--#include file="common_file_name"-->
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top