HTML | DOM Anchor username Property Last Updated : 09 May, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report The Anchor username Property in HTML DOM is used to set or return the value of the username part of the href attribute. The username part is used to define the username entered by the user. It is specified after the protocol and before the password part. For example: https://manaschhabra:[email protected]/ (manaschhabra is the username and manaschhabra499 is the password). Syntax: It return the Anchor username property. anchorObject.username It is used to set the Anchor username property. anchorObject.username = username Property Values: It contains single value username which specify the username part of the URL. Return Value: It returns a string value which represents the username part of the URL. Example 1: This example returns the Anchor username Property. html <!DOCTYPE html> <html> <head> <title> HTML DOM Anchor username Property </title> </head> <body> <center> <h1>GeeksForGeeks</h1> <h2>DOM Anchor username Property</h2> <p>Welcome to <a href = "https://manaschhabra:[email protected]/" id="GFG"> GeeksforGeeks </a> </p> <button onclick = "myGeeks()">Submit</button> <p id = "sudo" style="color:green;font-size:25px;"></p> <!-- Script to return Anchor username Property --> <script> function myGeeks() { var x = document.getElementById("GFG").username; document.getElementById("sudo").innerHTML = x; } </script> </center> </body> </html> Output: Before Clicking on Button: After Clicking on Button: Example 2: This example sets the anchor username property. html <!DOCTYPE html> <html> <head> <title> HTML DOM Anchor username Property </title> </head> <body> <center> <h1>GeeksForGeeks</h1> <h2>DOM Anchor username Property</h2> <p>Welcome to <a href = "https://manaschhabra:[email protected]/" id="GFG"> GeeksforGeeks </a> </p> <button onclick = "myGeeks()">Submit</button> <p id = "sudo" style="color:green;font-size:25px;"></p> <!-- Script to set Anchor username Property --> <script> function myGeeks() { var x = document.getElementById("GFG").username = "Harshitchhabra"; document.getElementById("sudo").innerHTML = "The username was changed to " + x; } </script> </center> </body> </html> Output: Before Clicking on Button: After Clicking on Button: Supported Browsers: The browser supported by DOM Anchor username property are listed below: Google Chrome Firefox Opera Comment More infoAdvertise with us Next Article HTML DOM Anchor target Property M manaschhabra2 Follow Improve Article Tags : Misc Web Technologies HTML HTML-DOM Practice Tags : Misc Similar Reads HTML DOM Anchor rel Property The Anchor rel Property in HTML DOM is used to set or return the value of the rel attribute of a link. The rel attribute is used to specify the relation between the current document and the linked document. Syntax: It returns the Anchor rel property. anchorObject.relIt is used to set the Anchor rel 2 min read HTML DOM Anchor rev Property The HTML DOM Anchor rev property is used to set or return the value of the rev attribute of the <a> element. The rev attribute is used to specify the relationship between the linked document and the current document. Note: This property is not supported by HTML5. Syntax: It returns an anchor r 2 min read HTML DOM Anchor search Property The Anchor search Property in HTML DOM is used to set or return the querystring part of the href attribute. The querystring part is specified after the question mark(?) in the URL. It is often used for parameter passing. Syntax: It returns the Anchor search property. anchorObject.searchIt is used to 2 min read HTML DOM Anchor Text Property The Anchor text Property in HTML DOM is used to set or return the text content of a link. Syntax: It returns the Anchor text property. anchorObject.textIt is used to set the Anchor text property. anchorObject.text = sometextProperty Values: It contains single value sometext which specifies the text 2 min read HTML DOM Anchor target Property The Anchor target Property in HTML DOM is used to set or return the value of the target attribute of a link. The Target attribute is used to specify where to open the link. Syntax: It returns the target property. anchorObject.targetIt is used to set the target property. anchorObject.target = "_blank 2 min read HTML DOM Anchor type Property The Anchor type Property in HTML DOM is used to set or return the value of the type attribute of a Link. The type attribute is used to specify the MIME type of the target URL and it is usually purely advisory. Syntax: It returns the Anchor type Property. anchorObject.type It is used to set the Ancho 2 min read Like