Iframes Quick Ref

Iframe code

<iframe src="yourpage.htm" width="400pxs" height="200px"></iframe>

To remove the border add frameborder="no" to the opening tag
To remove the scrollbars add scrolling="no" to the opening tag.

Load into iframe

window.frames['iframe_name'].location
or
document.getElementById('iframe_id').src

Replace the parent page from an iframe

parent.location.href='yourpage.htm'
or
<a href="yourpage.htm" target="_top">Link</a>

Reference element in iframe

window.frames['iframe_name'].document.getElementById('elementID').innerHTML
window.frames['iframe_name'].document.forms["formName"]["elementName"].value

Call function in iframe from parent

window.frames['iframename'].functionName()"

Call function in parent from iframe

parent.functionName()

Go directly to the top of the parent page using a link in the iframe page

onclick="parent.scrollTo(0,0)"

Reload

onclick="document.getElementById('myiframe').contentWindow.location.reload(true)"
The true argument forces the page to be loaded from server, if you want it from cache use reload()


window.open('page.htm','Iframename')
document.getElementById('iframID').contentWindow.document.body.onclick=function() { myFunction()}

el.contentWindow.document.documentElement