
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
HTML DOM iFrame Object
The HTML DOM iframe Object represents the <iframe> element of an HTML document.
Let us now create iframe object −
Syntax
Following is the syntax −
document.createElement(“IFRAME”);
Properties
Following are the properties of iframe Object −
Property | Explanation |
---|---|
contentDocument | It returns the document object generated by an iframe HTML element. |
contentWindow | It returns the window object generated by an iframe HTML element. |
height | It returns and modify the value of height attribute of an iframe HTML element. |
name | It returns and modify the value of the name attribute of an iframe HTML element. |
sandbox | It returns and alter the value of sandbox attribute of an iframe HTML element. |
seamless | It returns and modify whether the iframe should look seamless like it is a part of web page i.e. without borders and without scrollbars. |
src | It returns and modify the value of src attribute of an iframe HTML element. |
srcdoc | It returns and modify the value of srcdoc attribute of an iframe HTML element. |
width | It returns and alter the value of width attribute of an iframe HTML element. |
Example
Let us see an example of DOM iframe object −
<!DOCTYPE html> <html> <head> <style> body{ text-align:center; } .btn{ background-color:lightblue; border:none; height:2rem; border-radius:50px; width:60%; margin:1rem auto; } </style> </head> <body> <h1>DOM IFrame Object Example</h1> <button onclick="createIframe()" class="btn">Click me to create an iframe</button> <script> function createIframe() { var x = document.createElement("IFRAME"); x.setAttribute("src", "https://tutorialspoint.com/"); document.body.appendChild(x); } </script> </body> </html>
Output
This will produce the following output −
Click on “Click me to create an iframe” button to create an iframe −
- Related Articles
- HTML DOM Object Object
- HTML DOM HTML Object
- HTML DOM Ins Object
- HTML DOM HR Object
- HTML DOM Variable Object
- HTML DOM aside Object
- HTML DOM Anchor Object
- HTML DOM TableData Object
- HTML DOM TableHeader Object
- HTML DOM TableRow Object
- HTML DOM Textarea Object
- HTML DOM Meter Object
- HTML DOM MouseEvent Object
- HTML DOM Nav Object
- HTML DOM Ol Object

Advertisements