Area target attribute

Definition and usage

target Sets or returns the target of the area Target attribute value.

target The attribute specifies the location where the linked document is opened.

Instance

Example 1

Change the target of a specific area in the image map:

document.getElementById("venus").target = "_blank";

Try it yourself

Example 2

Get the target of a specific area in the image map:

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

Try it yourself

Syntax

Return target attribute:

areaObject.target

Set target attribute:

areaObject.target = "_blank|_self|_parent|_top|framename"

Attribute value

Value Description
_blank Open the document linked in a new window.
_self Open the document linked by clicking in the same frame (default).
_parent Open the document of the link in the parent frame set.
_top Open the document of the link in the entire window.
framename Open the document of the link in the named frame.

Technical details

Return value: String value indicating the location of the document to be opened by the link.

Browser support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support

Related pages

HTML reference manual:HTML <area> target attribute