Latest web development tutorials

atribut judul HTML DOM

Elemen Object Reference objek elemen


Definisi dan Penggunaan

title set properti atau mengembalikan elemen judul.

tatabahasa

HTMLElementObject.title=title


Dukungan Browser

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Semua browser utama mendukung atribut judul


contoh

contoh 1

Mengembalikan atribut judul elemen 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>

Output:

Body title: mytitle
An alternate way: mytitle

Coba »

contoh 2

Kembali pada bidang gambar judul peta:

<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>

Coba »


Elemen Object Reference objek elemen