Tuesday, December 18, 2012

shape

Properti HTMLAnchorElement.shape menetapkan atau mengembalikan atribut SHAPE elemen A HTML.

Sintaks:

anchorObj.shape = value anchorObj.shape

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

Contoh di bawah ini menetapkan atribut SHAPE:

<OBJECT DATA="image.png" USEMAP="#mymap" TYPE="image/png" TITLE="Site map" WIDTH="300" HEIGHT="200"> <MAP NAME="mymap"> <UL> <LI><A HREF="#" TITLE="Visit to A.html" COORDS="5,5,95,195">visit...</A></LI> <LI><A HREF="#" TITLE="Visit to B.html" COORDS="105,5,195,195">visit...</A></LI> <LI><A HREF="#" TITLE="Visit to C.html" COORDS="205,5,295,195">visit...</A></LI> </UL> </MAP> </OBJECT> <SCRIPT TYPE="text/javascript"> var anchorObj1 = document.getElementsByTagName("a")[0]; var anchorObj2 = document.getElementsByTagName("a")[1]; var anchorObj3 = document.getElementsByTagName("a")[2]; anchorObj1.shape = "rect"; anchorObj2.shape = "circle"; anchorObj3.shape = "rect"; </SCRIPT>

Sehingga semua elemen A terlihat seperti:

<UL> <LI><A HREF="#" TITLE="Visit to A.html" COORDS="5,5,95,195" SHAPE="rect">visit...</A></LI> <LI><A HREF="#" TITLE="Visit to B.html" COORDS="105,5,195,195" SHAPE="circle">visit...</A></LI> <LI><A HREF="#" TITLE="Visit to C.html" COORDS="205,5,295,195" SHAPE="rect">visit...</A></LI> </UL>