abson
abson

Reputation: 9348

Javascript clearing a frame

I am using a frameset with 3 frames, using parent.error.document.write("hi") I wrote to one of the frames but I want to clear it from another frame. Is it possible to do the same?

Upvotes: 0

Views: 1454

Answers (2)

Teemu
Teemu

Reputation: 23406

Without seeing your code I can only guess possible reasons.

  1. You have ids in <frame>s instead of names.

  2. You've created content to the target frame using document.write() already, without document.close(). In this case the document is not cleared when writing again.

  3. Document in target frame has been loaded from different domain.

If there's nothing to repair according the list above, you can try to refer frameTwo-document with top.window.frameTwo.document, or top.window.frames['frameTwo'].document.

Upvotes: 1

Jivings
Jivings

Reputation: 23250

Say your two frames are like so:

<frameset framespacing="0" rows="*"> 
       <frame name="frameOne" src="frame1.html">
       <frame name="frameTwo" src="frame2.html">
</frameset>

From inside frameOne you should be able to access frameTwo by:

window.parent.frameTwo.document

Upvotes: 0

Related Questions