Sunday, October 14, 2012

longDesc

Properti HTMLImageElement.longDesc menetapkan atau mengembalikan atribut LONGDESC elemen IMG HTML.

Sintaks:

imageObj.longDesc = value imageObj.longDesc

value adalah DOMString yang bisa berisi full URIs (misal: 'http://www.example.com/'), atau relative URIs (misal: 'foo.html' atau '../foo/').

Contoh di bawah ini mengembalikan nilai atribut LONGDESC:

<IMG ID="imgID" SRC="image.jpg" WIDTH="50" HEIGHT="50" LONGDESC="longDescForThisImage.html"> <SCRIPT TYPE="text/javascript"> var imgObj = document.getElementById("imgID"); alert(imgObj.longDesc); // "longDescForThisImage.html" </SCRIPT>

Contoh di bawah ini menetapkan atribut LONGDESC:

<IMG ID="imgID" SRC="image.jpg" WIDTH="50" HEIGHT="50"> <SCRIPT TYPE="text/javascript"> var imgObj = document.getElementById("imgID"); imgObj.longDesc = "longDescForThisImage.html"; </SCRIPT>

Elemen IMG di atas akan menjadi:

<IMG ID="imgID" SRC="image.jpg" WIDTH="50" HEIGHT="50" LONGDESC="longDescForThisImage.html">