Link to home
Start Free TrialLog in
Avatar of rfr1tz
rfr1tz

asked on

can't write into frame

I open a web page containing two frames - the frame  names are "top" and "bottom".

From the page in the "top" frame, I open a new dialog (using javascript window.open). The user clicks on a button in that  dialog, and I want to open a page in the "bottom" frame of the original window.

I've tried my usual  -  parent.frames['bottom'].document.location = "the url I want to display in the frame".

But this didn't work.


Maybe window.open creates another parent?

In any case, can anyone tell me how to aim a URL at that bottom frame?


Avatar of Zyloch
Zyloch
Flag of United States of America image

Hi rfr1tz,

Yes, you would do parent.parent.frames['bottom'].location.href="theurl.html";

Regards,
Zyloch
ASKER CERTIFIED SOLUTION
Avatar of COBOLdinosaur
COBOLdinosaur
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Oops, that's my bad. Cd, you're right ;)

Regards...
And if that fails it is because you have named your frame using the reserved property name top.  Probably a good idea to change it no matter what you do, because sooner or later it will jump up and bite you.

Cd&
Avatar of rfr1tz
rfr1tz

ASKER

Good point Dino. But actually I didn't name it 'bottom' - that was just for illustration.
Actually the reserved name is _top, with the underscore, is it not ?
It seems to be like that in links, like _self, for example, but if look at any frame breaking code in Javascript:

top.location=self.location

Apparently, in Javascript, you take away the underscore. In any case, Cd's frames[] array part should fix it fine and dandy