HighDots Forums  

body onLoad

Javascript (German) Programmiersprache JavaScript. (de.comp.lang.javascript)


Discuss body onLoad in the Javascript (German) forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Alexander Huemer
 
Posts: n/a

Default body onLoad - 01-13-2004 , 09:02 AM






Hallo!

Ich bastle jetzt schon seit ein paar Tagen und suche jetzt hier Hilfe.
Ich habe ein Frameset (topframe, leftframe, mainframe).
Beim Laden des leftframe möchte ich im mainframe eine seite laden lassen,
das schaffe ich aber leider nicht.
Meine momentane Codezeile schaut so aus:

<body onLoad="top.mainframe.href = 'rechts_blank.htm';">

was zumindest im IE6 eine Fehlermeldung produziert.
Es wäre sehr nett wenn jemand die Zeile richtigstellen könnte.
Vielen Dank!

lg
Alex



Reply With Quote
  #2  
Old   
Frank Seitz
 
Posts: n/a

Default Re: body onLoad - 01-13-2004 , 09:19 AM






Alexander Huemer wrote:

Quote:
body onLoad="top.mainframe.href = 'rechts_blank.htm';"

was zumindest im IE6 eine Fehlermeldung produziert.
Es wäre sehr nett wenn jemand die Zeile richtigstellen könnte.
Versuchs mal mit:

<body onLoad="top.mainframe.location.href = 'rechts_blank.htm';">

Gruß
Frank
--
Dipl.-Inform. Frank Seitz; http://www.fseitz.de/
Tel: 04103/180301; Fax: -02; Industriestr. 31, 22880 Wedel



Reply With Quote
  #3  
Old   
Dietmar Meier
 
Posts: n/a

Default Re: body onLoad - 01-13-2004 , 09:23 AM



Alexander Huemer wrote:

Quote:
top.mainframe.href = 'rechts_blank.htm'
href ist eine Eigenschaft von Location-Objekten.
top.mainframe referenziert aber ein Window-Objekt.

Du suchst:
top.mainframe.location.href = 'rechts_blank.htm'

Quote:
was zumindest im IE6 eine Fehlermeldung produziert.
Nullinformation. Bitte lies einmal http://glasgoogle.de.

ciao, dhgm


Reply With Quote
  #4  
Old   
Alexander Huemer
 
Posts: n/a

Default Re: body onLoad - 01-13-2004 , 09:39 AM



Danke für die schnelle Antwort!

Hab ich jetzt versucht und bekomme die Fehlermeldung:

'top.mainframe.location' ist Null oder kein Objekt.
Was mache ich falsch?



Reply With Quote
  #5  
Old   
Dietmar Meier
 
Posts: n/a

Default Re: body onLoad - 01-13-2004 , 09:50 AM



Alexander Huemer wrote:

Quote:
Hab ich jetzt versucht
Was hast Du versucht? -> http://got.to/quote

Quote:
und bekomme die Fehlermeldung:

'top.mainframe.location' ist Null oder kein Objekt.
Was mache ich falsch?
Du hast vermutlich ein Timingproblem: das load-Ereignis
erfolgt vor dem Vorhandensein des Frames "mainframe".

Abhilfe: setze onload des Framesets in top eine Variable
auf "1", die Du zuvor im Head auf "0" setzt. Frage an
der Stelle, die nun den Fehler verursacht, diese Variable
ab. Ist sie noch "0", warte eine Weile (setTimeout) und
prüfe erneut. Erst wenn sie "1" ist, greife auf die
dann vorhandenen Eigenschaften des Nebenframes zu.

Ungetesteter Quickhack:

index.html:
....
<script ...>
var myFlag = 0;
</script>
....
<frameset ... onload="myFlag=1">
....

leftframe.html:
....
<script ...>
function pruefe() {
if (top.myFlag) top.mainframe.location.href = ...;
else setTimeout(pruefe, 500);
}
</script>
....
<body onload="pruefe()">
....

ciao, dhgm



Reply With Quote
  #6  
Old   
Ulrike Jahnke-Soltau
 
Posts: n/a

Default Re: body onLoad - 01-13-2004 , 10:02 AM



Alexander Huemer wrote:

Quote:
'top.mainframe.location' ist Null oder kein Objekt.
Was mache ich falsch?
Dreckfehler, oder du hängst vielleicht tiefer in den Frames drin, als du
vermutest (Billigprovider).
Im letzteren Fall probiere mal parent.mainframe.location.href

und probiere mal

alert(top.frames[i].name);

mit i von 0 bis frames.length, um zu sehen, welche Fenster überhaupt im
Angebot vom DOM für das Javascript (richtig so, Georg? ;-)) sind.

so long,
uja






Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.