Archivlink: javarea.de Forum > JavaScript > iFrame laden mit NS & FF
Vollständigen Link anzeigen: javarea.de Forum > JavaScript > iFrame laden mit NS & FF

Pages: [1]

geschrieben von sobi am 12.10.2005 - 11:56
Folgendes Script bewirkt, dass eine SubSeite in den richtigen iFrame geladen wird, wenn sie ausserhalb des iFrame mit dem Browser aufgerufen wird::
HTML-Quelltext
1: 
2: 
3: 
4: 
5: 
6: 
7: 
8: 
9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
19: 
20: 
21: 
22: 
23: 
24: 
25: 
26: 
27: 
28: 
29: 
30: 
31: 
32: 
33: 
34: 
35: 
36: 
37: 
38: 
39: 
40: 
<html>
<head>
<!-- In diese Seite werden die Inhalte der Startseite und Sub Seiten nachgeladen -->


<script type="text/javascript" language="javascript">
<!--
   function IFrameStart() {

          var URL = location.search;
          var URL = URL.substring(1,URL.length);

          if(URL)
          document.inlineframe.location.href = URL;

          else
          document.inlineframe.location.href = './startseite.html';
   }

   if (self.location.href != top.location.href) { 		
 	        parent.location.href=self.location.href;
   }
//-->
</script>


<link rel="stylesheet" type="text/css" href="iFrame.css" >

</head>
<body onLoad="IFrameStart()">
<br>
<br>
<a href="sub seite 2.html" target="inlineframe">Andere Seite laden</a>
<br>
<br>

<iframe id="inlineframe" name="inlineframe" border="0" frameborder="1" framespacing="0"></iframe>

</body>
</html>


Hier der Code in der SubSeite::
HTML-Quelltext
1: 
2: 
3: 
4: 
5: 
6: 
7: 
8: 
9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
19: 
20: 
21: 
22: 
<html>
<head>

<script type="text/javascript" language="JavaScript">
// current Script by Uli Sobers   [http://free.templates.sobers.de]
<!--
   if(!parent.inlineframe) // inlineframe = Framename
   location.href="./iframe.html?"+ location.pathname;
// -->
</script>

<noscript><meta http-equiv="refresh" content="0;URL=./nojava.html"></noscript>


</head>
<body>

Inhalt Sub Seite


</body>
</html>

In der Sartseite steht derselbe Code wie in der SubSeite.

Das Ganze funzt mit IE und Opera prima. Mit NS und FF bleibt der iFrame leer. Kennt jemand eine Lösung ??? (Rene ??? )

cu http://www.schmaili.com/smileys/41.gif
Uli

geschrieben von René am 12.10.2005 - 13:43
HTML-Quelltext
1: 
2: 
3: 
4: 
5: 
6: 
7: 
8: 
9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
19: 
20: 
21: 
22: 
23: 
24: 
25: 
26: 
27: 
28: 
29: 
30: 
<html>
<head>

<script language="javascript" type="text/javascript">
<!--
if (self != top)
	top.location.href = self.location.href;

function IFrameStart()
{
	if (location.search)
	{
		var sea = location.search;
		var url = sea.substring(1, sea.length);

		inlineframe.location.href = url;
	}
}
//-->
</script>

<link rel="stylesheet" type="text/css" href="iFrame.css" />

</head>
<body onload="IFrameStart()">

<iframe id="inlineframe" name="inlineframe" src="./startseite.html" border="0" frameborder="1" framespacing="0"></iframe>

</body>
</html>


HTML-Quelltext
1: 
2: 
3: 
4: 
5: 
6: 
7: 
8: 
9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
19: 
20: 
21: 
22: 
23: 
<html>
<head>

<script language="JavaScript" type="text/javascript">
<!--
// current Script by Uli Sobers   [http://free.templates.sobers.de]

   if (!top.inlineframe) // inlineframe = Framename
	   top.location.href = './iframe.html?' + location.pathname;
//-->
</script>

<noscript>
  <meta http-equiv="refresh" content="0; url=./nojava.html" />
</noscript>

</head>
<body>

Inhalt Sub Seite

</body>
</html>

geschrieben von sobi am 12.10.2005 - 18:56


Powered by: JBB v.2.0.4 Copyright ©2000-2006, www.javarea.de.