Kotwica docelowa Właściwość
Przykład
Zmień cel linku na "_blank" (link zostanie otwarty w nowym oknie):
document.getElementById("myAnchor").target = "_blank";
Definicja i użycie
Właściwość target ustawia lub zwraca wartość atrybutu target łącza.
Atrybut target określa, gdzie otworzyć połączony dokument.
Obsługa przeglądarki
Property | |||||
---|---|---|---|---|---|
target | Yes | Yes | Yes | Yes | Yes |
Składnia
Zwróć właściwość docelową:
anchorObject.target
Ustaw właściwość docelową:
anchorObject.target = "_blank|_self|_parent|_top|framename"
Wartości nieruchomości
Value | Description |
---|---|
_blank | Opens the linked document in a new window |
_self | Opens the linked document in the same frame as it was clicked (this is default) |
_parent | Opens the linked document in the parent frameset |
_top | Opens the linked document in the full body of the window |
framename | Opens the linked document in a named frame |
Szczegóły techniczne
Wartość zwrotu: | String, oznaczający, gdzie otworzyć połączony dokument |
---|
Więcej przykładów
Przykład
Zwróć wartość atrybutu target linku:
var x =
document.getElementById("myAnchor").target;
Powiązane strony
Odniesienie HTML: HTML <a> atrybut docelowy
❮ Obiekt kotwicy