Properti HTMLAreaElement.accessKey
menetapkan atau mengembalikan atribut ACCESSKEY elemen AREA HTML.
Sintaks:
areaObj.accessKey = value
areaObj.accessKey
value adalah DOMString yang berisi single Unicode character. Ada beberapa browser tidak mengijinkan memberikan nilai 'a', 'c', 'e', 'f', 'g', 'h', 'v', 'left arrow', atau 'right arrow'.
Contoh di bawah ini menetapkan atribut ACCESSKEY untuk semua elemen AREA:
<MAP NAME="mymap">
<AREA ID="areaID1" HREF="A.html" TITLE="Visit to A.html" ALT="Visit to A.html" SHAPE="rect" COORDS="5,5,95,195">
<AREA ID="areaID2" HREF="B.html" TITLE="Visit to B.html" ALT="Visit to B.html" SHAPE="rect" COORDS="105,5,195,195">
<AREA ID="areaID3" HREF="C.html" TITLE="Visit to C.html" ALT="Visit to C.html" SHAPE="rect" COORDS="205,5,295,195">
</MAP>
<IMG SRC="image.png" ALT="Site map" USEMAP="#mymap" WIDTH="300" HEIGHT="200">
<SCRIPT TYPE="text/javascript">
var areaObj1 = document.getElementById("areaID1");
var areaObj2 = document.getElementById("areaID2");
var areaObj3 = document.getElementById("areaID3");
areaObj1.accessKey = "a";
areaObj2.accessKey = "b";
areaObj3.accessKey = "c";
</SCRIPT>
Sehingga semua elemen AREA akan seperti di bawah ini:
<MAP NAME="mymap">
<AREA ID="areaID1" HREF="A.html" TITLE="Visit to A.html" ALT="Visit to A.html" SHAPE="rect" COORDS="5,5,95,195" ACCESSKEY="a">
<AREA ID="areaID2" HREF="B.html" TITLE="Visit to B.html" ALT="Visit to B.html" SHAPE="rect" COORDS="105,5,195,195" ACCESSKEY="b">
<AREA ID="areaID3" HREF="C.html" TITLE="Visit to C.html" ALT="Visit to C.html" SHAPE="rect" COORDS="205,5,295,195" ACCESSKEY="c">
</MAP>