Target if using frames

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Target if using frames

Post by Ruth »

I was messing with the unsupported frames code and figured out how to use the function and everything, but what if your 'main' menu also had just a plain link in it, could you get it to open in a particular frame, like you have the submenus open, and if so how would you do that?

Ruth
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

Hi Ruth,

Specify the target frame in the URL field of the menu item definition.

Code: Select all

,"Home","mainpage.htm target=main",,,1
If I recall correctly, there's no need to specify the sourceframe unless the item is opening a submenu in a different frame, although with some builds, if you didn't put in a sourceframe anyway, like this

Code: Select all

,"Home","mainpage.htm target=main;sourceframe=main",,,1
then the offbgcolor would remain.

Ummm... Should we move this to the v3 forum? ;)

Cheers,

Kevin
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hmm, no it's with version 5. I was playing with the function that Hergio threw together for all those who were asking about using 5 with frames to see what was up. It only refers to opening sub menus so I wondered how would you just open a link in that frame if one of your menu items didn't have a submenu but was only a direct link to a page.

Ruth
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

Oh, I see. You even mentioned "unsupported frames code" although I could have sworn that it said "frames example". Oops. :oops: Sorry.

I guess you'd just have to set the target property for that menu item to the name of the frame where you want the url to appear. For example, say the menu item was in your nav frame, and your content shows up in a frame named "main". Your menu item might look like so:

Code: Select all

aI("text=Home;url=mainpage.htm;target=main;");
Haven't really played with v5 in frames, so this is just conjecture.

Kevin
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Just for your info, that doesn't work, but it's not a big deal, I'm not making a frames site [though I'm one of those that thinks there are instances when frames are the best option], I was just messing around trying to learn things. Thanks :)

Ruth
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

Hi Ruth,
...that doesn't work...
Well now I found that odd. Seems like it ought to work, right? So you know what I had to do... Not being one to resist, I tried it myself. Only thing is... it worked in IE5/5.5/6, NS7.1, Moz1.2.1, and Opera7.20 in Win2k. At the risk of sounding silly... Are you using the name of your content frame in the target property? In my example, I used target="main" because within my <frameset>, the <frame> holding the content is set to name="main". So if your content frame is named something else, you'd have to use that name instead. E.g., consider the following frameset:

Code: Select all

<frameset rows="50,*">
  <frame name="nav" scrolling="no" noresize src="nav.htm">
  <frame name="body" scrolling="no" noresize src="body.htm">
</frameset>
In this case, there are two frames named "nav" and "body". The main menu would be loaded into the file called nav.htm, which is displayed in the "nav" frame. Main menu items that do not open submenus would set target=body to open pages in the "body" frame, like so:

Code: Select all

aI("text=Products;url=products.htm;target=body;");
In this case, we use target=body because that's the name given to the frame where we want to display the page. If that doesn't work for you, then there's more to the puzzle and I'm left wondering what browser/os you're using?

Cheers,

Kevin
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Just slap me upside the head. It helps if you actually put the danged page into the url. :oops: It actually works perfectly. I think I will take a vacation.

Ruth
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

I won't slap you upside the head if you won't slap me upside the head for thinking that you were talking about v3 at the top of the thread!

Just to continue (because you got me curious), I tried the frames thing in a couple of other browsers. It did not work in IE4.01, NS4.75, and Opera6.05 (Win2k). I put a <base target="body"> tag in the <head> section of nav.htm and that worked for IE4.01 and Opera 6.05. But NS4.75 just crapped out (what else is new... who knows what caused it... screw it anyway). Interestingly, the <base> tag trick also worked for the all of the newer browsers I tried earlier... IE5/5.5/6, NS7.1, Moz1.2.1, Opera7.20... without having to specify the target in each menu item. In otherwords, if you only have one content frame, and if you use

Code: Select all

<head>
  <base target="your_content_frame">
</head>
in your navigation frame's html file, then you can define your menu items' links without specifying the target in each item, like

Code: Select all

aI("text=Menu Text;url=theUrlYouWant.htm";);
Saves having to type target=whatever; in each aI().

FWIW,

Kevin
Post Reply