HTML | DOM HTML Object Last Updated : 07 Feb, 2019 Comments Improve Suggest changes Like Article Like Report The HTML Object property in HTML DOM is used to represent or access the HTML <html> element with in the object. The <html> element is used to return the HTML document as an Element Object. Syntax: It is used to access a <html> element.var x = document.getElementsByTagName("HTML")[0]; It can also be used to access a <html> element.var x = document.documentElement; Property Values: getElementsByTagName(): It is used to return a collection of all child elements with the specified tag name. innerHTML: It is used to set or return the content of an element. getElementsById(): It is used to return a collection of all child elements with the specified Id. Example-1: Access HTML element using document.getElementsByTagName("HTML")[0]; html <!DOCTYPE html> <html> <title> HTML | DOM HTML Object Property </title> <style> body { text-align: center; width: 70%; } h1 { color: green; } h1, h2 { text-align: center; } </style> <body> <h1>GeeksforGeeks</h1> <h2> HTML Object</h2> <p>Click the button to get the HTML content of the html element.</p> <button onclick="GFG()">Click</button> <p id="Geeks"></p> <script> function GFG() { // Access html element and return using "innerHTML" var x = document.getElementsByTagName( "HTML")[0].innerHTML; document.getElementById("Geeks").innerHTML = x; } </script> </body> </html> Output: Before Click On the Button: After Click On the Button: Example-2: Access html element and return element is first or second. html <!DOCTYPE html> <html> <title> HTML | DOM HTML Object Property </title> <style> body { text-align: center; width: 70%; } h1 { color: green; } h1, h2 { text-align: center; } </style> <body> <h1>GeeksforGeeks</h1> <h2> HTML Object</h2> <p>Click the button to get the HTML content of the html element.</p> <p>Using the document.documentElement</p> <button onclick="GFG()">Click</button> <p id="Geeks"></p> <script> function GFG() { // Access html element and return html // with position value of html element. var x = document.documentElement.innerHTML; document.getElementById( "Geeks").innerHTML = "first" + x; var y = document.documentElement.innerHTML; document.getElementById( "Geeks").innerHTML = y + "second"; } </script> </body> </html> Output: Before Click On the Button: After Click On the Button: Example-3: Access html element and return all child with specified tag name. html <!DOCTYPE html> <html> <title> HTML | DOM HTML Object Property </title> <style> body { text-align: center; width: 70%; } h1 { color: green; } h1, h2 { text-align: center; } </style> <body> <h1>GeeksforGeeks</h1> <h2> HTML Object</h2> <p>Click the button to get the HTML content of the html element.</p> <p>Using the getElementsByTagName("HTML")[0] and documentElement</p> <button onclick="GFG()">Click</button> <p id="Geeks"></p> <script> function GFG() { // access and return html element var x = document.getElementsByTagName( "HTML")[0].innerHTML; document.getElementById("Geeks").innerHTML = "getElementsByTagName" + x; var y = document.documentElement.innerHTML; document.getElementById("Geeks").innerHTML = y + "documentElement"; } </script> </body> </html> Output: Before Click On the Button: After Click On the Button: Supported Browsers: The browser supported by DOM HTML Object property are listed below: Google Chrome Internet Explorer Firefox Opera Safari Comment More infoAdvertise with us Next Article HTML | DOM HTML Object S SHUBHAMSINGH10 Follow Improve Article Tags : Web Technologies HTML HTML-DOM Similar Reads HTML | DOM Style maxHeight Property The maxHeight property set/return the maximum height of an element. The maxHeight property affect only on block-level elements, absolute or fixed position elements. Syntax: It is used to set the maxHeight property:object.style.maxHeight = "none|length|%|initial|inherit"It is used to return the maxHe 2 min read 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 Like