HTMLAnchorElement: thuộc tính target
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
Thuộc tính target của giao diện HTMLAnchorElement là một chuỗi cho biết nơi hiển thị tài nguyên được liên kết.
Giá trị
Một chuỗi đại diện cho mục tiêu. Giá trị của nó có thể là:
- Tên của một
<frame>. - Một trong các từ khóa có giá trị cụ thể:
_blank,_self,_parent, hoặc_top.
Ví dụ
html
<a href="www.example1.com" class="link1" target="_blank">example1</a>
js
const link = document.querySelector(".link1");
console.log(link.target); // xuất ra: "_blank"
Đặc tả kỹ thuật
| Specification |
|---|
| HTML> # dom-a-target> |
Trình duyệt hỗ trợ
Xem thêm
- Thuộc tính
HTMLBaseElement.target - Thuộc tính
HTMLFormElement.target - Thuộc tính
HTMLAreaElement.target