write to an iframe
write to an iframe
(OP)
i have used it before i just can't seem to remember how.
so something like..
i know its not close, but just to be clear what i'm talking about.
document.iframe.write();
so something like..
i know its not close, but just to be clear what i'm talking about.
document.iframe.write();
RE: write to an iframe
With the help of this article here:
http://xkr.us/articles/dom/iframe-document/
(found using Google), I came up with this:
CODE
<head>
<script type="text/javascript">
<!--
function populateIframe() {
var ifrm = document.getElementById('myIframe');
ifrm = (ifrm.contentWindow) ? ifrm.contentWindow : (ifrm.contentDocument.document) ? ifrm.contentDocument.document : ifrm.contentDocument;
ifrm.document.open();
ifrm.document.write('Hello World!');
ifrm.document.close();
}
//-->
</script>
</head>
<body onload="populateIframe();">
<iframe id="myIframe"></iframe>
</body>
</html>
It works in IE6, FF1, NN7, and Opera7. It probably works in other browsers, too.
Hope this helps,
Dan
The answers you get are only as good as the information you give!
RE: write to an iframe