HTML DOM title property
Definitions and usages
The title property sets or returns the title of the element.
Grammar
Browser support
The title property is supported by all major browsers
Instance 1
Returns the title property of the body element:
<body id="myid" title="mytitle">
<script>
varx=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>
Output:
An alternate way: mytitle
Try it out . . .
Instance 2
Return to the area map title in the image:
<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>
varx=document.getElementById('venus')
document.write(x.title)
</script>
</p>
</body>
</html>
Try it out . . .