목차
- <abbr> 객체 정의 - 축약어
- <abbr> 객체 구문
- <abbr> 객체 예제 - 접근
- <abbr> 객체 예제 - 생성
- <abbr> 객체 속성
<abbr> 객체 정의 - 축약어
HTML <abbr> 태그(요소) 의미.
<abbr> 객체 구문
[접근]
var x = document.getElementById("요소ID");
[생성]
var x = document.createElement("ABBR");
<abbr> 객체 접근
<p><abbr id="hz" title="Beyond The Scene">BTS</abbr> : 방탄소년단</p>
<button onclick="homzzang()">클릭</button>
<p id="demo"></p>
<script>
function homzzang() {
var x = document.getElementById("hz").title;
document.getElementById("demo").innerHTML = x;
}
</script>
결과보기
<abbr> 객체 생성
<button onclick="homzzang()">클릭</button>
<p id="hz"></p>
<script>
function homzzang() {
var x = document.createElement("ABBR");
var t = document.createTextNode("BTS");
x.setAttribute("title", "Beyond The Scene");
x.appendChild(t);
document.getElementById("hz").appendChild(x);
}
</script>
결과보기
<abbr> 객체 속성
title
축약어에 마우스커서 위치 시, 축약어의 전체 글자 표시. (=풀 스펠링 Full Spelling)
※ <abbr> 객체는 표준 속성/메서드/이벤트 지원.