Thursday, September 20, 2012

shape

Properti HTMLAreaElement.shape menetapkan atau mengembalikan atribut SHAPE elemen AREA HTML.

Sintaks:

areaObj.shape = value areaObj.shape

value adalah DOMString yang bisa berisi 'rect', 'circle', atau 'poly'.

Contoh di bawah ini mengembalikan nilai atribut SHAPE:

<MAP NAME="mymap"> <AREA ID="areaID" SHAPE="circle" COORDS="124,58,8" HREF="#" TITLE="Visit to..."> </MAP> <IMG WIDTH="145" HEIGHT="126" SRC="image.png" USEMAP="#mymap"> <SCRIPT TYPE="text/javascript"> var areaObj = document.getElementById("areaID"); alert(areaObj.shape); // "circle" </SCRIPT>

Contoh di bawah ini menetapkan atribut SHAPE:

<MAP NAME="mymap"> <AREA ID="areaID" COORDS="124,58,8" HREF="#" TITLE="Visit to..."> </MAP> <IMG WIDTH="145" HEIGHT="126" SRC="image.png" USEMAP="#mymap"> <SCRIPT TYPE="text/javascript"> var areaObj = document.getElementById("areaID"); areaObj.shape = "circle"; </SCRIPT>

Elemen AREA di atas akan menjadi:

<AREA ID="areaID" COORDS="124,58,8" HREF="#" TITLE="Visit to..." SHAPE="circle">