Board Logo

Target help needed!
geurt - 11/4/2003 at 09:44 AM

How do i target a page to a frame? I tried everything but it doenst work for me, please can anyone help?

My page looks like this at the moment and i want all links open up in the frame "inhoud" anyone?


var TREE_ITEMS = [
['Begin', 'intro.html',
['Geschiedenis', 'geschiedenis.html',
['Schneider Papier Benelux', 'http://www.webjoker.nl'] ,
['Schneidersohne', null],
],

['Services', 'http://www.softcomplex.com/services.html'],
['Contacts', 'http://www.softcomplex.com/contacts.html'],
]
];


rock - 11/4/2003 at 05:15 PM

You sould modify 'target' key in your TREE_TPL var.
E.g.
'target' :'inhoud',


Brucecris - 1/27/2005 at 10:31 PM

Does this support targeting multiple pages to multiple targets? I want to load a page into one frame and another one in a second frame. Currently i see only one target but is there a hack to enable a secondary target to another document? thanks


wfmichels - 1/30/2005 at 10:42 PM

Hi,

I've been trying to get Tigra Tree Menu to allow me to open different URL's in different windows, including files, URL's and javascript references. To get window.open to work with Javascript calls it seems the TARGET must be set to "_self". But when that's set, HTTP pages also open in "_self". If the tree menu is is a side frame this is dreadfully inconvenient.

A simple way to fix this is as follows:

<body>

<FONT CLASS=menu_title>My Menus</FONT><HR>

<FONT CLASS=heading>Menu 1</FONT><BR>

<script language="JavaScript">
new tree (MENU1_ITEMS, TREE1_TPL);
</script>

<BR><FONT CLASS=heading>Menu 2</FONT><BR>

<script language="JavaScript">
new tree (MENU2_ITEMS, TREE2_TPL);
</script>

<BR><FONT CLASS=heading>Menu 3</FONT><BR>

<script language="JavaScript">
new tree (MENU3_ITEMS, TREE3_TPL);
</script>


<script language="JavaScript">

for (var i = 0; i < document.links.length ; i++) {
var mystr = document.links.href.substring(0,4).toLowerCase();
document.links.target = mystr + i;
if (mystr == "java") {
document.links.target = '_self';
}
}

</script>

<!-- /Body -->
</body>


Each separate menu has it's own template and list of items. After the menu items are defined, this script resets the TARGET for each link to a unique value. To make sure I can still open new windows with JAVASCRIPT calls, I set the TARGET to "_self" for those items.

An improvement to this would be to set the menu link to some unique value (like "MYLINKCODE2") in the TREE_ITEMS array and then look for that code somewhere in the HREF value for each document link. If found you can set the target and the real URL to what you want. You could even set up an array like

myinfo[MYLINKCODE2] = [ mytarget2, "the_real_url_goes_here" ];

to handle a larger number of choices.

Hope this is of use to someone.

Bill


wfmichels - 1/30/2005 at 10:47 PM

In prior post the form replaced some of the code with text formatting directives. Sorry!

Here's the important script again with a different counter index:

<script language="JavaScript">

for (var k = 0; k < document.links[k].length ; k++) {
var mystr = document.links[k].href.substring(0,4).toLowerCase();
document.links[k].target = mystr + i;
if (mystr == "java") {
document.links[k].target = '_self'
}
}

</script>


Softcomplex: http://www.softcomplex.com/
Back to forum: http://www.softcomplex.com/forum/