PDA

View Full Version : CFM3 - Change more than 1 frame?


Nico
18.05.2001, 05:59
Hi,

how do I have to modify the script in order to get it change more than 1 frame by one click?
Please help ...

Regards
Nico

Shane
18.05.2001, 11:37
Nico, there are many ways to do this, but a simple one, without having to modify the menu code, is to use the onclick feature that is built in to the menus. In the head, create a function like this.... ( or paste this one ). rightFrame is the name of the frame you want to change

<script language="javascript">
function swapframe(url){
parent.rightFrame.location.href=url;
}
</script>

In the menu item where you want this to happen, the 14th variable, the onclick one, should call the swapframe() function......

oCMenu.makeMenu('top0','','*News','http://www.yahoo.com','','','','','','','','','','swapfra me("http://www.yahoo.com");')

This way, you can add the call to swapframe in any link you want, and specify the page.


I forgot to add, I only checked this in explorer, so if it doesn't work in Netscape let me know.
//ShAnE

Edited by - Shane on 05/18/2001 10:39:00

Shane
18.05.2001, 12:17
Okay....I just reinstalled netscape 4.77 and 6.01 ( had to reinstall the OS yesterday ). That function will work in both of those browsers too.

//ShAnE

PSECU
18.05.2001, 14:37
Greetings...

I encountered a similar problem and found the following solution...

Create the following .JS file and call it '1link2frames.js'...

function separa(links){
var parti = new Array();
var fin= new Array();
//var stringa = self.location.href;
//parti= stringa.split("#");
lung= parti.length;
//fin = parti[1].split(",");
fin = links.split(",");
lung= fin.length;
frames.frmMain.location.href=fin[1]
frames.frmLeft.location.href=fin[0]


Within your 'index.html', add the following...

<SCRIPT LANGUAGE="JavaScript" src="scripts/1link2frames.js" TYPE="text/javascript"></SCRIPT>

Within your 'frmTop.html' use the following example...

oCFMenu.makeSub2('Checking',0,0,"top.separa('products_services/frmLeft.html,products_services/checking/index.html')")

Virtually yours...
Craig Malcolm Petrou
Webmaster, PSECU
cpetrou@psecu.com

Nico
18.05.2001, 17:47
Hi Shane, hi Craig

Thank you so much for your help !!!
If I have well understood, Shan´'s solution allows to change ONE further frame. What, if I want to change more than 2 frames?

Craig, does your solution allows to change as many frame as I want?

Greetings and thanx
Nico

Shane
18.05.2001, 18:37
I think Craig's will allow you to swap more than one frame also. If you would like to do it my way, you can easily swap as many frames as you have.....

<script language="javascript">
function swapframe(url1, url2, url3){
parent.rightFrame.location.href=url1;
parent.leftFrame.location.href=url2;
parent.bottomFrame.location.href=url3;
}
</script>

In the menu item where you want this to happen, the 14th variable, the onclick one, should call the swapframe() function......

oCMenu.makeMenu('top0','',' News','http://www.yahoo.com','','','','','','','','','','swapfra me("http://www.yahoo.com","http://www.excite.com","http://www.dhtmlcentral.com");')

Just like that, very simple.

//ShAnE

Nico
19.05.2001, 17:25
Thanx somuch , Shane.

The solution is indeed >very simple<; it's just a question of knowledge, which haven't got yet, hmm concerning JScripting! ;-)

Btw I love your way too

Greetings
Nico

Shane
19.05.2001, 17:51
No problem.
Glad to help


//ShAnE