JavaScript를 사용하여 클라이언트 측 이미지 맵을 만듭니다. 클라이언트 측 이미지 맵은 태그의 usemap 속성에 의해 활성화되고 특수
지도를 구성할 이미지는 usemap이라는 추가 속성을 전달한다는 점을 제외하고는 평소와 같이 요소를 사용하여 페이지에 삽입됩니다. . usemap 속성 값은 파운드 또는 해시 기호가 앞에 오는
예시
다음 코드를 실행하여 클라이언트 측 이미지 맵을 생성할 수 있습니다. −
<html>
<head>
<title>Using JavaScript Image Map</title>
<script type="text/javascript">
<!--
function showTutorial(name) {
document.myform.stage.value = name
}
//-->
</script>
</head>
<body>
<form name="myform">
<input type = "text" name = "stage" size = "20" />
</form>
<!-- Create Mappings -->
<img src="/images/usemap.gif" alt="HTML Map" border="0" usemap="#tutorials"/>
<map name="tutorials">
<area shape="poly"
coords="74,0,113,29,98,72,52,72,38,27"
href="/perl/index.htm" alt="Perl Tutorial"
target="_self"
onMouseOver="showTutorial('perl')"
onMouseOut="showTutorial('')"/>
<area shape="rect"
coords="22,83,126,125"
href="/html/index.htm" alt="HTML Tutorial"
target="_self"
onMouseOver="showTutorial('html')"
onMouseOut="showTutorial('')"/>
<area shape="circle"
coords="73,168,32"
href="/php/index.htm" alt="PHP Tutorial"
target="_self"
onMouseOver="showTutorial('php')"
onMouseOut="showTutorial('')"/>
</map>
</body>
</html>