Properti target jangkar
Contoh
Ubah target tautan menjadi "_blank" (tautan akan dibuka di jendela baru):
document.getElementById("myAnchor").target = "_blank";
Definisi dan Penggunaan
Properti target menetapkan atau mengembalikan nilai atribut target tautan.
Atribut target menentukan tempat untuk membuka dokumen tertaut.
Dukungan Peramban
Property | |||||
---|---|---|---|---|---|
target | Yes | Yes | Yes | Yes | Yes |
Sintaksis
Kembalikan properti target:
anchorObject.target
Tetapkan properti target:
anchorObject.target = "_blank|_self|_parent|_top|framename"
Nilai properti
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 |
Detail Teknis
Nilai Kembali: | Sebuah String, mewakili tempat untuk membuka dokumen yang ditautkan |
---|
Lebih Banyak Contoh
Contoh
Kembalikan nilai atribut target tautan:
var x =
document.getElementById("myAnchor").target;
Halaman Terkait
Referensi HTML: HTML <a> atribut target
Objek Jangkar