Ändern von frame-locations

kiff124

Mitglied
Hallo Leute,
ich versuche verzweifelt, ein Frame (in der Datei body.php) von der Datei menu.php aus zu ändern.
Wenn ich folgenden Code anwende:
PHP:
function go(URL1,F1,URL2,F2) {
   parent.frames[F1].location.href=URL1;
    parent.frames[F2].location.href=URL2;

}
Dann bekomm ich nur:
Code:
parent.frames is not defined

Geht das trotzdem noch irgendwie?

Dankbar für jede brauchbare Hilfe ;)

Kevin
 
Hi,

wenn sich das Frameset in der Datei body.php befindet und es das übergeordnete Dokument zu menu.php ist, sollte es funktionieren.

body.php:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
   "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>www.tutorials.de (Frameset)</title>
</head>
  <frameset cols="184,*" frameborder="1" framespacing="0">
    <frame name="frame_links" src="menu.php">
    <frame name="frame_rechts" src="datei.php">
  </frameset>
</html>

menu.php:
Code:
<html>
<head>
<title>www.tutorials.de</title>
<meta name="author" content="Quaese">
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
  <!--
function go(URL1,F1,URL2,F2) {
  parent.frames[F1].location.href=URL1;
  parent.frames[F2].location.href=URL2;

}
 //-->
</script>
</head>
<body>
<p><button onclick="go('dok1.html','frame_links','dok2.html','frame_rechts');">Frames ändern</button></p>
</body>
</html>

Ciao
Quaese
 
Ich glaub ich Demel hab ich mich Falsch ausgedrückt... Also, mein Source sieht in etwa so aus:

Index.php
Code:
<frameset framespacing="0"   border="1" frameborder="1"  bordercolor="#000000" rows="37,*">
  <frame name="banner" scrolling="no" noresize target="Inhalt" src="menu.php">
  <frame name="Haupt1" src="body.php">
  <noframes>
  <body>

  <p>Diese Seite verwendet Frames. Frames werden von Ihrem Browser aber nicht 
  unterstützt.</p>

  </body>
  </noframes>

</frameset>

Body.php
Code:
<frameset rows="*" framespacing="0" border="1" frameborder="1" bordercolor="#000000">
  <frameset cols="397,*">
  <frame id="Haupt" name="Haupt" src="news.php" target="_self" noresize scrolling="auto" />
    <frame id="Inhalt" name="Inhalt" target="Haupt" src="pic.php" noresize scrolling="auto">
    

  </frameset>
  <noframes>

So, nun soll das Framestück im body.php geändert werden.
Also jeweils Haupt und Inhalt.
Aber das Problem ist ja, das das menu.php in der Index.php "verankert" ist...
 
Hi,

versuch es mal mit
Code:
function go(URL1,F1,URL2,F2) {
  top.Haupt1.frames[F1].location.href=URL1;
  top.Haupt1.frames[F2].location.href=URL2;

}

Ciao
Quaese
 
Hi,

wie rufst du die Funktion auf?

Es sollte in etwas wie folgt aussehen:
Code:
<button onclick="go('haupt.html','Haupt','inhalt.html','Inhalt');">Frames ändern</button>

Ciao
Quaese
 
Zurück