faqts : Computers : Internet : Web : HTML : Frames

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

45 of 56 people (80%) answered Yes
Recently 6 of 10 people (60%) answered Yes

Entry

How do I create a link that changes the content of an IFRAME?
How do I create a link that changes the content of an IFRAME?
How do I create a link that changes the content of an IFRAME?

Aug 14th, 2000 00:13
Rey Nuņez, Ben Gordon,


If you are using only floating (or inline) frames (iframe), you can 
reference them exactly like standard frames:

<IFRAME SRC="page1.htm" NAME="iFrame1"></IFRAME>
<A HREF="newpage.htm" TARGET="iFrame1">

and in script:
parent.frames(n).location.href="newpage.htm"

where n refers to the ordinal index (the order in which the iframe 
appears in the frames collection of a page), starting at zero (0). 

If you combine floating frames with regular frames, the floating frames 
have to be treated differently. Floating frames are added to the 
document object, not to the regular frames collection.

To access a floating frame on the current page, use: 
document.iFrameName.propertyName

To access a floating frame in a different frame, use: 
top.frames[n].document.iFrameName.propertyName

For more information on scripting an iframe, see:
http://www.faqts.com/knowledge-base/view.phtml/aid/1797/fid/127/lang/