HTML DOM Area Object

Area Object

The Area object represents an HTML <area> element.

Access an Area Object

You can access an <area> element by using getElementById():

Example

var x = document.getElementById(“myArea”);

Try it Yourself »

Create an Area Object

You can create an <area> element by using the document.createElement() method:

Example

var x = document.createElement(“AREA”);

Try it Yourself »

Area Object Properties

Property Description
alt Sets or returns the value of the alt attribute of an area
coords Sets or returns the value of the coords attribute of an area. The coordinates of the top-left corner of an area are 0,0.
hash 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 (#)
host Sets or returns the hostname and port part of the href attribute value. The href attribute specifies the destination of a link in an area.
hostname Sets or returns the hostname part of the href attribute value. The href attribute specifies the destination of a link in an area
href Sets or returns the value of the href attribute of an area. The href attribute specifies the destination of a link in an area.
noHref Not supported in HTML5.
Sets or returns the value of the nohref attribute of an area
origin Returns the protocol, hostname and port part of the href attribute value. If the port number is not specified in the URL (or if it is the scheme’s default port – like 80, or 443), some browsers will not display the port number.
password Sets or returns the password part of the href attribute value. In a URL, the password part is the password entered by the user. It is specified after the username and before the hostname.
pathname Sets or returns the pathname part of the href attribute value. The href attribute specifies the destination of a link in an area.
port Sets or returns the port part of the href attribute value
protocol Sets or returns the protocol part of the href attribute value
search Sets or returns the querystring part of the href attribute value
shape Sets or returns the value of the shape attribute of an area
target Sets or returns the value of the target attribute of an area
username Sets or returns the username part of the href attribute value

Standard Properties and Events

The Abbreviation object supports the standard properties and events.


Related Pages

HTML reference: HTML <area> tag

Post Author: Zahid Farid