faqts : Computers : Programming : Languages : JavaScript : Frames

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

96 of 121 people (79%) answered Yes
Recently 7 of 10 people (70%) answered Yes


How can I load a new URL into an IFRAME?
How can I load a new URL into an IFRAME?

May 18th, 2002 21:05
Daniel LaLiberte, Martin Honnen,

If you NAME your IFRAME e.g.
  <IFRAME NAME="anIframe" ...>
you can script
  window.frames.anIframe.location.href = 'whatever.html'
<A HREF="javascript: void 0"
   ONMOUSEOVER="window.frames.anIframe.location.href =
<IFRAME NAME="anIframe" SRC="http://www.FAQTs.com"
You can also target a link, or post a form with a target that
is the name of the iframe.  This requires the user to take the
action that loads the iframe, whereas an assignment to the location.href
of the iframe can be done in any JavaScript code.
  <A HREF="http://JavaScript.FAQTs.com" TARGET="anIframe">
  <IFRAME NAME="anIframe" src=""