In addition to this, you could set the src of the main frame in your
frameset to be a blank page (blank.htm, blank.asp or whatever it is you're
doing).
Then from within the script frame onLoad event do something like this
top.mainFrame.document.location.replace "main.htm"
This ensures that your script frame has definitely finished loading before
you try to call anything from within the main frame.
Peter.
"Lasse Reichstein Nielsen" <lr*@hotpop.com> wrote in message
news:el**********@hotpop.com...
Da Costa Gomez <dc*@xs4all.nl> writes:
2. Since I want this new page to be loaded *before* I go into the next
function I figured setting parent.main.onload = function2bCalled
whilst going into the startFunction() would do the trick.
Not so!! It sets the parent.main.onload allright but after
parent.main.location.href="newPage.html" it does NOT go into
function2bCalled().
As you explain it, it sounds like you set the window's onload handler
before setting the href. Loading a new page gives a new global
javascript object, i.e., a new window object, so the onload handler is
long gone when the page is loaded.
Does anybody have a clue as to what is going on here? I'm nearing my
gaga point.
You can try this as a test:
parent.frames['main'].foo = 42;
parent.frames['main'].location.href="newPage.html";
alert(parent.frames['main'].foo);
It should turn out to alert "undefined". The same goes for your
onload handler.
I think your best chance is to let "newPage.html" have its own
onload handler, which can then call a function you have set up
in advance. E.g.
parent.frames['script'].callback = function2bCalled;
parent.frames['main'].location.href="newPage.html";
and then "newPage.html"'s onload handler calls
parent.frames['script'].callback();
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'