Area username Property
Example
Return the username part of the URL for a specific area in an image-map:
var x =
document.getElementById("venus").username;
The result of x will be:
johnsmith
Try it Yourself »
Definition and Usage
The username property sets or returns the username part of the href attribute value.
The href attribute specifies the destination of a link in an area.
In a URL, the username part is the username entered by the user. It is specified after the protocol and before the password part.
Example: https://johnsmith:smith123@www.example.com (johnsmith is the username and smith123 is the password).
Tip: Use the password property to set or return the password part of the href attribute value.
Browser Support
Property | |||||
---|---|---|---|---|---|
username | Yes | Not supported | Yes | Not supported | Yes |
Syntax
Return the username property:
areaObject.username
Set the username property:
areaObject.username=username
Property Values
Value | Description |
---|---|
username | Specifies the username part of a URL |
Technical Details
Return Value: | A String, representing the username part of the URL |
---|
More Examples
Example
Change the username part of a specific area in an image-map:
document.getElementById("venus").username = "newUsername";
Try it Yourself »
Area Object