HTML DOM 앵커 객체
앵커 개체
Anchor 객체는 HTML <a> 요소를 나타냅니다.
앵커 개체에 액세스
getElementById()를 사용하여 <a> 요소에 액세스할 수 있습니다.
예시
var x = document.getElementById("myAnchor");
앵커 개체 만들기
document.createElement() 메서드를 사용하여 <a> 요소를 만들 수 있습니다.
예시
var x = document.createElement("A");
앵커 개체 속성
Property | Description |
---|---|
charset | Not supported in HTML5. Sets or returns the value of the charset attribute of a link |
download | Sets or returns the value of the download attribute of a link |
hash | Sets or returns the anchor part of the href attribute value |
host | Sets or returns the hostname and port part of the href attribute value |
hostname | Sets or returns the hostname part of the href attribute value |
href | Sets or returns the value of the href attribute of a link |
hreflang | Sets or returns the value of the hreflang attribute of a link |
origin | Returns the protocol, hostname and port part of the href attribute value |
name | Not supported in HTML5. Use element.id instead. Sets or returns the value of the name attribute of a link |
password | Sets or returns the password part of the href attribute value |
pathname | Sets or returns the pathname part of the href attribute value |
port | Sets or returns the port part of the href attribute value |
protocol | Sets or returns the protocol part of the href attribute value |
rel | Sets or returns the value of the rel attribute of a link |
rev | Not supported in HTML5. Sets or returns the value of the rev attribute of a link |
search | Sets or returns the querystring part of the href attribute value |
target | Sets or returns the value of the target attribute of a link |
text | Sets or returns the text content of a link |
type | Sets or returns the value of the type attribute of a link |
username | Sets or returns the username part of the href attribute value |
표준 속성 및 이벤트
Anchor 객체는 표준 속성 과 이벤트 도 지원합니다 .
관련 페이지
HTML 튜토리얼: HTML 링크
HTML 참조: HTML <a> 태그