HTML DOM 제목 속성
정의 및 사용
제목 속성 집합 또는 제목 요소를 반환합니다.
문법
HTMLElementObject.title=title
브라우저 지원
모든 주요 브라우저 표제 속성을 지원
예
예 1
본체 부재의 표제 특성 반환
<html>
<body id="myid" title="mytitle">
<script>
var x=document.getElementsByTagName('body')[0];
document.write("Body title: " + x.title);
document.write("<br>");
document.write("An alternate way: ");
document.write(document.getElementById('myid').title);
</script>
</body>
</html>
<body id="myid" title="mytitle">
<script>
var x=document.getElementsByTagName('body')[0];
document.write("Body title: " + x.title);
document.write("<br>");
document.write("An alternate way: ");
document.write(document.getElementById('myid').title);
</script>
</body>
</html>
출력 :
Body title: mytitle
An alternate way: mytitle
An alternate way: mytitle
»시도
예 2
위로 이미지 영역 맵 제목 :
<html>
<body>
<img src ="planets.gif"
width="145" height="126"
alt="Planets"
usemap ="#planetmap">
<map name ="planetmap">
<area id="venus" shape="circle"
coords ="124,58,8"
title="Venus"
href ="venus.htm">
</map>
<p>Venus' advisory title (mouse over the Venus planet):
<script>
var x=document.getElementById('venus')
document.write(x.title)
</script>
</p>
</body>
</html>
<body>
<img src ="planets.gif"
width="145" height="126"
alt="Planets"
usemap ="#planetmap">
<map name ="planetmap">
<area id="venus" shape="circle"
coords ="124,58,8"
title="Venus"
href ="venus.htm">
</map>
<p>Venus' advisory title (mouse over the Venus planet):
<script>
var x=document.getElementById('venus')
document.write(x.title)
</script>
</p>
</body>
</html>
»시도