Window object (Contentwindow)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.