Thema: frames
Einzelnen Beitrag anzeigen
Alt 22.09.2005, 15:52   #18
jak
Inventar
 
Registriert seit: 13.06.2001
Beiträge: 1.830


Standard

Zitat:
Original geschrieben von ruffy_mike
Ausserdem gibt es ja die Möglichkeit, zu überprüfen, ob die Frame-Seite im entspr. parent-Frame läuft, wenn nicht, wird dieser nachgeladen.
Das macht z.B. Microsoft im MSDN:

Code:
<form name="MNPFramesForm" method="post" target="_top" action="/pfadZurSeite/Seite.mspx">
</form>
<script language="javascript">
	var framesValid = false; 
	var menuFrame = parent.frames["MNPMenuFrame"]; 
		if (menuFrame) { framesValid = true; } 
	} 
	if (!framesValid) document.forms["MNPFramesForm"].submit();
</script>
An sich find' ich die Idee mit der <form> ziemlich gut, ich würd's aber ein bischen anders machen:
Code:
<form name="frameForm" method="get" action="/frame.php">
<!-- oder:
<form name="frameForm" method="get" action="/frame.html">
-->
  <input type="hidden" name="frame">
  etc.
</form>
<script language="javascript">
if (!wirSindDasObersteFrame){
  var form = document.forms["frameForm"];
  form.frame = document.location.href
</script>
Entweder hat man dann ein frame.php daß die Anzeige erledigt oder man macht es mit JavaScript (Pseudocode):
Code:
<script>
var loc=window.location.search
Suche in loc nach 'frame=xyz'
Speichere 'xyz' in Variable a
Setze den Unterframe auf a:
document.frames['main'].location.href=a
</script>
Wäre auch ausbaufähig (frame1=a.html&frame2=b.html), mann bräuchte dann nur mehrere <input>s und müsste den String bei jedem & aufspalten.

jak
____________________________________
Join the DNRC | Godwin\'s Law (thx@stona)
Documentation is like sex: If it\'s good, it\'s very, very good. If it\'s bad, it\'s better than nothing.
\"In theory, theory and practice are the same. In practice, they are not\" (Lawrence Berra)
jak ist offline   Mit Zitat antworten