HTML DOM title özelliği

Tanım ve Kullanım

title özelliği, elemanın (danışma niteliğinde) başlığını ayarlar veya döndürür.

Gramer:

object.title=title

Örnek 1

Bu örnek, <body> elementinin title özelliğini almanın iki yöntemini gösterir:

<html>
<body id="myid" title="mytitle">
<script type="text/javascript">
x=document.getElementsByTagName('body')[0];
document.write("Body başlığı: "+) x.title);
document.write("<br />")}
document.write("Bir alternatif yol: ");
document.write(document.getElementById('myid').title);
</script>
</body>
</html>

Örnek 2

Bu örnek, görsel haritada bir alanın title özelliğini döndürür:

<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' danışmanlık başlığı (Venus gezegenine fareyi getir): 
<script type="text/javascript">
x=document.getElementById('venus')
document.write(x.title)
</script>
</p>
</body>
</html>