-
Notifications
You must be signed in to change notification settings - Fork 22.4k
/
index.md
47 lines (32 loc) · 1.17 KB
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
---
title: "HTMLAreaElement: target property"
short-title: target
slug: Web/API/HTMLAreaElement/target
page-type: web-api-instance-property
browser-compat: api.HTMLAreaElement.target
---
{{ApiRef("HTML DOM")}}
The **`target`** property of the {{domxref("HTMLAreaElement")}} interface is a string that indicates where to display the linked resource.
It reflects the [`target`](/en-US/docs/Web/HTML/Element/area#target) attribute of the {{HTMLElement("area")}} element.
## Value
A string representing the target. Its value can be:
- The name of a {{HTMLElement("frame")}}.
- One of the [keyword with specific values](/en-US/docs/Web/HTML/Element/area#target):`_blank`, `_self`, `_parent`, or `_top`.
## Example
```html
<map name="image-map">
<area href="www.example.com" target="_top" alt="left" />
</map>
```
```js
const areaElement = document.getElementsByName("image-map")[0].areas[0];
console.log(areaElement.target); // Output: "_top"
```
## Specifications
{{Specifications}}
## Browser compatibility
{{Compat}}
## See also
- {{domxref("HTMLBaseElement.target")}} property
- {{domxref("HTMLFormElement.target")}} property
- {{domxref("HTMLAnchorElement.target")}} property