HTML | DOM IFrame Object Last Updated : 06 May, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report The IFrame Object property in HTML DOM is used to create and access the <iframe> element within the object. An inline frame is used for embedding another document within the current HTML document. Syntax:It is used to access a <iframe> element.var x = document.getElementById("myframe");It is used to create a <iframe> element.var x = document.createElement("IFRAME");Property Values:align: It is used to set or return the value of the align attribute in the iframe. It is not supported bu HTML 5.contentDocument: It is used to return the document object generated by an iframe.contentWindow: It is used to return the window object generated by an iframe.frameBorder: It is used to set or return the frameborder attribute in the iframe. It is not supported by HTML 5.height: It is used to set or return the height attribute in the iframe.longDesc: It is used to set or return the value of the longdesc attribute in an iframe. It is not supported by HTML 5.marginHeight: It is used to set or return the value of the marginheight attribute in an iframe. It is not supported by HTML 5.marginWidth: It is used to set or return the value of the marginwidth attribute in an iframe. It is not supported by HTML 5.name: It is used to set or return the value of the name attribute in an iframe.sandbox: It is used to return the value of the sandbox attribute in an iframe.scrolling: It is used to set or return the value of the scrolling attribute in an iframe. It is not supported by HTML 5.seamless: It is used to set or return whether an iframe should look like it is a part of the containing documentsrc: It is used to set or return the value of the src attribute in an iframe.srcdoc: It is used to set or return the value of the srcdoc attribute in an iframe.width: It is used to set or return the value of the width attribute in an iframe.Example 1: This example describes the getElementById() method to access <iframe> element. HTML <!DOCTYPE html> <html> <head> <title> HTML DOM IFrame Object </title> </head> <body> <h1>GeeksforGeeks</h1> <h2>DOM IFrame Object Property</h2> <button onclick = "myGeeks()"> Click Here! </button> <br><br> <iframe id = "GFGFrame" src = "https://www.geeksforgeeks.org/community/" width = "400" height = "200"> </iframe> <p id = "GFG"></p> <!-- script to access iframe element --> <script> function myGeeks() { var x = document.getElementById("GFGFrame").src; document.getElementById("GFG").innerHTML = x; } </script> </body> </html> Output: Before Click on the button:DOM IFrame Object Note: The content in the iframe isn’t showing because the website has blocked it for security reasons. You can try using a different link that allows embedding.Example 2: This example describes the document.createElement() method to create <iframe> element. HTML <!DOCTYPE html> <html> <head> <title> HTML DOM IFrame Object </title> </head> <body> <h1>GeeksforGeeks</h1> <h2>DOM IFrame Object Property</h2> <button onclick = "myGeeks()"> Click Here! </button> <br><br> <!-- script to create iframe element --> <script> function myGeeks() { /* Create iframe element */ var ifram = document.createElement("IFRAME"); /* Set the source attribute */ ifram.setAttribute("src", "https://www.geeksforgeeks.org/community/"); /* Set the iframe height */ ifram.setAttribute("height", "200"); /* Set the iframe width */ ifram.setAttribute("width", "400"); document.body.appendChild(ifram); } </script> </body> </html> Output: Before Click on the button:DOM IFrame ObjectNote: The content in the iframe isn’t showing because the website has blocked it for security reasons. You can try using a different link that allows embedding.Supported Browsers: The browser supported by DOM IFrame Object property are listed below:Google Chrome 1.0 and aboveEdge 12.0 and aboveFirefoxInternet ExplorerOpera Safari Comment More infoAdvertise with us Next Article HTML | DOM Window parent Property S SHUBHAMSINGH10 Follow Improve Article Tags : Web Technologies HTML HTML-DOM Similar Reads HTML | DOM Style borderTopStyle Property The DOM Style borderTopStyle property is used to set or return the top border style of an element. Syntax: To get the borderTopStylePropertyobject.style.borderTopStyleTo set the borderTopStylePropertyobject.style.borderTopStyle = "none | hidden | dotted | dashed | solid | double | groove |ridge | in 7 min read HTML | DOM Style transitionDuration Property The Style transitionDuration property in HTML DOM is used to set or return the length of time(in seconds or milliseconds) to complete the transition effect. Syntax: Return the transitionDuration property:object.style.transitionDurationSet the transitionDuration:object.style.transitionDuration = "tim 1 min read HTML ondragstart Event Attribute HTML ondragstart Event Attribute is used when the user wants to drag the text or element. It is simply the process in which we press on the desired text to drag and drop them to a different location. Basically, it Initiates when the user starts dragging an element and is used to set data to be trans 3 min read HTML | DOM Style animationDelay Property The animationDelay Property in HTML DOM is used to set or returns the delay after which the animation should start. Syntax: It is used to set the animationDelay property:object.style.animationDelay = "time|initial|inherit"It is used to return the animationDelay property:object.style.animationDelay P 3 min read HTML | DOM Window parent Property HTML DOM Window parent Property returns the parent window of the current window. It is a read-only property. If a window does not have a parent, then it refers to itself. Syntax: window.parent Return Value: Parent Window object of current window. If there is no parent window then it refers to itself 1 min read HTML DOM isDefaultNamespace() Method The DOM isDefaultNamespace() method is used to return boolean true if the specified namespace is default otherwise, it returns boolean false. The URI of the namespace required can be checked using the namespaceURI string. Syntax:node.isDefaultNamespaceReturn Value: It returns a boolean value true if 1 min read HTML | DOM Style animationName Property The animationName Property in HTML DOM is used to set or returns a name for @keyframes animation. Syntax: It is used to set the animationName property:object.style.animationName = "none|keyframename|initial|inherit"It is used to return the animationName property:object.style.animationName Property V 3 min read HTML DOM Style transition Property The HTML DOM Style Property is used to change the appearance of any DIV element. It changes the appearance whenever the mouse hovers over that element. SyntaxFor return the transition property:object.style.transitionFor set the transition property:object.style.transition = "property duration timing 2 min read HTML | DOM Textarea maxlength Property The DOM Textarea maxlength Property is used to set or return the value of the maxlength attribute of a textarea field. It specifies the maximum number of characters that have been allowed in the Element. Syntax: It is used to return the maxLength property: textareaObject.maxLength It is used to set 2 min read HTML | DOM meter Object The DOM Meter Object is used to represent the HTML <meter> element. The meter element is accessed by getElementById().Properties: form: It belongs to one or more forms that it belongs too.max: It is used to specify the maximum value of a range.min: It is used to specify the minimum value of a 2 min read Like