Click to See Complete Forum and Search --> : change 2 frames with one link


spooooky
06-17-2003, 08:38 AM
Hi!

I got a navigation problem. I´m working with a menu frame and a main frame. the menu frame works with javasript buttons: u click it, a sub-menu opens.

my problem is now as follows: I want links in the main frame to fulfill multiple tasks when clicked:

- open new navi-page in the menu frame
- open a sub menu in that page
- change content in main frame

or at least the last 2

is that possible using javascript??

here´s the link, maybe u get a better idea of what I mean
http://www.wiwi.uni-rostock.de/~prowi/

thx

Khalid Ali
06-17-2003, 09:22 AM
Its totlly do-able.
Try to write your code and ask for help on these forums for particular parts of it.

spooooky
06-17-2003, 09:46 AM
Ok, the menu buttons work as follows:

<head>
<base target="Hauptframe">
...
<body>

...
<div id="Klausuren" style="display: none;">

<table border="0" cellpadding="3px" width="160" cellspacing="2" align="right">
<tr>
<td class="link2"><a class="link2" href="../Hauptseite/Studium_und_Lehre/Klausuren/Hinweis.htm">Hinweis</a></td>
</tr>
<tr>
<td class="link2"><a class="link2" href="../Hauptseite/Studium_und_Lehre/Klausuren/GBWL_I.htm">GBWL
I</a></td>
</tr>
...

so they work perfectly. and I now want it the other way round.
a link in "Hauptframe" should change
- the frame itself
- load a new page into the menuframe ("Inhalt")
- and do an action like "javascript:show('Klausuren') in that frame

so i think i need a function there like:

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
function loadFrames(page1,page2,button) {
eval("parent."Hauptframe".location='"+page1+"'");
eval("parent."Inhalt".location='"+page2+"'");
!-- sth like
show("+button+");
}
// End -->

</script>

SlankenOgen
06-17-2003, 10:31 AM
onclick="loadPages('first.html','second.html');

function loadPages(pA, pB)
{
parent.frames[0].location.href = pA;
parent.frames[1].location.href = pB;
}

~mgb

spooooky
06-17-2003, 11:02 AM
hmmm now it looks like this:

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
function loadFrames(page1,page2) {
eval(parent.frame[4].location.href=page1);
eval(parent.frame[3].location.href=page2);
}
// End -->
</script>

</HEAD>
...

<BODY>
...
<a href="javascript:loadFrames('../Download/Download.htm', '../Inhalt/Inhalt_Studium_und_Lehre.htm')"><strong>---&gt;
Download von Unterrichtsfolien &lt;---</strong></a>

i´m using "href" and "eval" because of my stylesheets

but anyway it doesnt work, nothing happens and it says "errors on page"

I´m quite new to javascript so i wouldn´t even see if there´s a syntax error :(

spooooky
06-17-2003, 11:56 AM
yeah! it works with this:

...
function loadFrames(page1,page2) {
eval("parent.Hauptframe.location.href='"+page1+"'");
eval("parent.Inhalt.location.href='"+page2+"'");
}
// End -->
</script>

</HEAD>

<BODY>
...
<a href="javascript:loadFrames('../../Download/Download.htm','../../Inhalt/Inhalt_Studium_und_Lehre.htm')">Download</a>
...

so far so good, now i´d like to open that menu in the frame "Inhalt" ?

i´d like to use that function for that like

function loadFrames(page1,page2,submenu) {
eval("parent.Hauptframe.location.href='"+page1+"'");
eval("parent.Inhalt.location.href='"+page2+"'");

--- command for open submenu ---

}


Is that possible??