HTML | DOM Link Object Last Updated : 28 Jul, 2022 Comments Improve Suggest changes Like Article Like Report HTML DOM Link Object is used to access HTML <link> element.Syntax: To Access a HTML element: document.getElementById("myLink"); To Create a New HTML element: document.createElement("LINK"); Property Values: ValueDescriptioncharsetIt assigns the character encoding of the linked documentcrossOriginIt assigns the the CORS settings of the linked documentdisabledIt assigns whether the linked document is disabled, or nothrefIt is used to set/return the URL of the linked documenthreflangIt assigns the language code of the linked documentmediaIt assigns the media type for the link elementrelIt assigns the relationship between the current document and the linked documentrevIt assigns the reverse relationship from the linked document to the current documentsizesReturns the sizes attribute's value of the linked resourcetypeIt is used to set/return the content type of the linked document Example-1: Accessing link element. html <!DOCTYPE html> <html> <head> <link id="linkid" rel="stylesheet" type="text/css" href="styles.css"> </head> <body> <h1>TO ACCESS LINK ELEMENT:</h1> <p>PRESS THE BUTTON TO GET THE URL OF THE LINKED DOCUMENT.</p> <button onclick="gfg()">Get URL </button> <p id="pid"></p> <script> function gfg() { // Access link element. var NEW = document.getElementById( "linkid").href; document.getElementById( "pid").innerHTML = NEW; } </script> </body> </html> Output:Before clicking: After clicking: Example-2: Create link element. html <!DOCTYPE html> <html> <head> </head> <body> <h1>TO CREATE A LINK ELEMENT.</h1> <button onclick="myFunction()">Create</button> <p id="pid"></p> <script> function myFunction() { // Create link element. var NEW = document.createElement( "LINK"); // set attributes. NEW.setAttribute("id", "linkid"); NEW.setAttribute("rel", "stylesheet"); NEW.setAttribute("type", "text/css"); NEW.setAttribute("href", "styles.css"); document.head.appendChild(NEW); var NEW1 = document.getElementById( "linkid").href; document.getElementById("pid").innerHTML = NEW1; } </script> </body> </html> Output:Before clicking: After clicking: Supported Browsers: ChromeFirefoxInternet ExplorerSafariOpera Comment More infoAdvertise with us Next Article HTML | DOM Link Object A AkshayGulati Follow Improve Article Tags : Web Technologies HTML HTML-DOM Similar Reads HTML DOM console groupEnd() Method The console.groupEnd() method in HTML is used to indicate the end of a group of messages in the console that has been created using the console.group() method. This method does not accept any parameter. Syntax:console.groupEnd()Example: The below program illustrates the console.groupEnd() method in 2 min read HTML DOM readyState Property The readyState property in HTML is used to return the loading status of the current document. This property is used for read-only. Syntax:document.readyStateReturn Value: It returns a string value which is used to define the status of the current document. The one of five status are listed below:uni 2 min read HTML DOM Location host Property The Location Host property in HTML is used to sets or return the hostname and port of a URL. The Location Hash property doesn't return the port number if it is not specified in the URL. Syntax: It returns the host property. location.hostIt is used to set the host property. location.host = hostname:p 1 min read HTML DOM Location protocol Property The Location protocol property in HTML is used to return the protocol or set the protocol of the current URL. It returns a string that contains the protocol of the current URL, including the colon (:). Syntax: It returns the protocol property. location.protocolIt is used to set the protocol property 1 min read HTML DOM Location pathname Property The Location pathname property in HTML is used to set or return the pathname of a URL. The Location pathname property returns a string that represents the pathname of the URL. Syntax: It returns the pathname property.location.pathnameIt is used to set the pathname property.location.pathname = pathEx 1 min read HTML DOM Location hostname Property The Location hostname property in HTML is used to return the hostname of the current URL. The Location hostname property returns a string that contains the domain name, or the IP address of a URL. Syntax: It returns the hostname property. location.hostname It is used to set the hostname property. lo 1 min read HTML DOM Location href Property The Location href property in HTML is used to set or return the complete URL of the current page. The Location href property can also be used to set the href value point to another website or point to an email address. The Location href property returns a string that contains the entire URL of the p 2 min read HTML | DOM Input Image Object The Input Image Object in HTML DOM is used to represent the HTML < input > element with type=âimageâ. This tag is used to access or create the element. This element can be accessed by using getElementById() method. Syntax: document.getElementById("MyImage"); Return Value: It return the propert 3 min read HTML | DOM Ol start Property The DOM Ol start property is used to set or return the value of the start attribute in an ordered list. The start attribute in HTML is used to specify the start value for numbering the individual list item. It is used with an ordered list. Syntax: It is used to return the start property. olObject.st 2 min read HTML | DOM Option disabled Property The DOM Option disabled Property is used to set or return whether the value of an option would be disabled or not. The disabled attribute for the element in HTML is used to specify that the option value is disabled. A disabled option is un-clickable and unusable. It is a boolean attribute. Syntax: I 2 min read Like