Iframe
The IFRAME element is a document in the document
Window object
The browser creates a corresponding Window object when it opens an HTML document. If a document defines one or more frames (that is, contains one or more frame or iframe labels), the browser creates a Window object for the original document, and then creates additional window objects for each frame. These additional objects are child windows of the original window and may be affected by events that occur in the original window. If you want to create new Windows (and corresponding window objects), you can use methods such as Open, ShowModalDialog, and showModelessDialog.
Contentwindow
The Contentwindow property refers to the specified frame
function Enableedit ()
{
var editor;
Editor = document.getElementById ("Htmledit"). Contentwindow;
For IE browser, make it editable
Editor.document.designMode = ' on ';
Editor.document.contentEditable = true;
For compatible with FireFox, it should open and write something
Editor.document.open ();
Editor.document.writeln (' Editor.document.writeln (' <style>body {background:white;font-size:9pt;margin:2px; padding:0px;} </style> ');
Editor.document.writeln (' Editor.document.close ();
}
<iframe id= "Htmledit" marginheight= "1" marginwidth= "1" width= "100%" height= "312" >
</iframe>
<body>
<script>
var IFR = document.createelement ("iframe");
Document.body.appendChild (IFR);
var ifrdoc = ifr.contentWindow.document;
var s = fixinghtb.innerhtml; Save well before entering editable mode
Ifrdoc.designmode = "on"; Document enters editable mode
Ifrdoc.open (); Open stream
Ifrdoc.write (s);
Ifrdoc.close (); Close the stream
Ifrdoc.designmode = "Off"; Document enters non-editable mode
</script>
</body>
Note: The main content of this article comes from the network
Window object (Contentwindow)