앵커 대상 속성
예시
링크 대상을 "_blank"로 변경합니다(링크는 새 창에서 열립니다):
document.getElementById("myAnchor").target = "_blank";
정의 및 사용
target 속성은 링크의 target 속성 값을 설정하거나 반환합니다.
target 속성은 링크된 문서를 열 위치를 지정합니다.
브라우저 지원
Property | |||||
---|---|---|---|---|---|
target | Yes | Yes | Yes | Yes | Yes |
통사론
대상 속성을 반환합니다.
anchorObject.target
대상 속성을 설정합니다.
anchorObject.target = "_blank|_self|_parent|_top|framename"
속성 값
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 |
기술적 세부 사항
반환 값: | 연결된 문서를 열 위치를 나타내는 문자열 |
---|
더 많은 예
예시
링크의 대상 속성 값을 반환합니다.
var x =
document.getElementById("myAnchor").target;
관련 페이지
HTML 참조: HTML <a> 대상 속성
❮ 앵커 개체