Area href attribute
Definition and usage
href
Attribute sets or returns the area href attribute values.
href
Attribute specifies the destination of the link within the area.
See also:
HTML Reference Manual:HTML <area> href attribute
Example
Example 1
Change the URL of the linked area within:
document.getElementById("venus").href = "sun.htm";
Example 2
Get the URL of the linked area within:
var x = document.getElementById("venus").href;
Example 3
Change the URL of the linked area to an absolute URL:
document.getElementById("venus").href = "http://www.codew3c.com/";
Syntax
Return the href attribute:
areaObject.href
Set the href attribute:
areaObject.href = URL
Attribute value
Value | Description |
---|---|
URL |
Hyperlink target within the specified area. Possible values:
|
Technical Details
Return Value: | A string value representing the URL of the link. Returns the entire URL, including the protocol (such as http://). |
---|
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |