THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

Area hash Property

Area Object Reference Area Object

Example

Return the anchor part of the URL for a specific area in an image-map:

var x = document.getElementById("venus").hash;

The result of x will be:

#description
Try it yourself »

Definition and Usage

The hash property sets or returns the anchor part of the href attribute value.

The href attribute specifies the destination of a link in an area.

The anchor part is the part of the URL after the hash sign (#).

Note: When this property is used to set the anchor part, do not include the hash sign (#).


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The hash property is supported in all major browsers.


Syntax

Return the hash property:

areaObject.hash

Set the hash property:

areaObject.hash=anchorname

Property Values

Value Description
anchorname Specifies the anchor part of a URL

Technical Details

Return Value: A String, representing the anchor part of a URL, including the hash sign (#)

More Examples

Example

Change the anchor part of a specific area in an image-map:

document.getElementById("venus").hash = "newhashvalue";
Try it yourself »

Related Pages

JavaScript reference: location.hash Property


Area Object Reference Area Object