เพื่อให้ได้ค่าของ usemap แอตทริบิวต์ของลิงก์ใน JavaScript ใช้ useMap คุณสมบัติ. usemap แอตทริบิวต์ใช้เพื่อระบุว่าเอกสารเป็น html (text/html) หรือ css (text/css) เป็นต้น
แผนที่รูปภาพฝั่งไคลเอ็นต์เปิดใช้งานโดย usemap แอตทริบิวต์สำหรับแท็ก และกำหนดโดยแท็กส่วนขยายพิเศษ
ตัวอย่าง
คุณสามารถลองเรียกใช้โค้ดต่อไปนี้เพื่อรับค่า usemap แอตทริบิวต์ของลิงค์ −
<!DOCTYPE html>
<html>
<body>
<img id="myid" src = "/images/html.gif" alt = "HTML Map" border = "0" usemap = "#html"/>
<map name = "html">
<area id="myarea" shape = "circle" coords = "154,150,59" href = "about.htm?id=company" alt = "Team" target = "_self" >
</map>
<script>
var myVal = document.getElementById("myid").useMap;
document.write("<br>Usemap value: "+myVal);
</script>
</body>
</html>