JavaScript

[HTML_Objects] JS - <map> 객체 - 이미지맵 (= map태그 = 이미지맵태그) ※ 이미지 특정 부분에 링크

목차

  1. <map> 객체 정의 - 이미지맵
  2. <map> 객체 구문
  3. <map> 객체 예제 - 접근
  4. <map> 객체 예제 - 생성
  5. <map> 객체 집합
  6. <map> 객체 속성

 

<map> 객체 정의 - 이미지맵

 

HTML <map> 태그(요소) 의미.

 

 

<map> 객체 구문

 

[접근]

var x = document.getElementById("요소ID");

 

[생성]

var x = document.createElement("MAP");

 

 

<map> 객체 예제 - 접근

 

<img src="https://i.imgur.com/TpbgVeE.gif" width="389" height="26" border="0" usemap="#hz">

<map name="hz" id="hz">

  <area shape="rect" coords="4,3,68,21" href="http://naver.com" target="_blank" onFocus="blur()">

  <area shape="rect" coords="78,4,119,20" href="http://daum.net" target="_blank" onFocus="blur()">

  <area shape="rect" coords="128,5,193,19" href="http://www.paran.com" target="_blank" onFocus="blur()">

  <area shape="rect" coords="204,3,259,20" href="http://nate.com" target="_blank" onFocus="blur()">

  <area shape="rect" coords="269,2,323,20" href="http://www.google.co.kr/" target="_blank" onFocus="blur()">

  <area shape="rect" coords="331,4,385,18" href="http://kr.yahoo.com/" target="_blank" onFocus="blur()">

</map>


<button onclick="homzzang()">클릭</button>


<p id="demo"></p>


<script>

function homzzang() {

  var x = document.getElementById("hz").areas.length;

  document.getElementById("demo").innerHTML = x;

}

</script> 

 

결과보기 

 

<map> 객체 예제 - 생성

 

<img src="https://i.imgur.com/TpbgVeE.gif" width="389" height="26" border="0" usemap="#hz">


<button onclick="homzzang()">클릭</button>


<p id="demo"></p>


<script>

function homzzang() {

  var x = document.createElement("MAP");

  x.setAttribute("id", "hz");

  x.setAttribute("name", "hz");

  document.body.appendChild(x);


  var y = document.createElement("AREA");

  y.setAttribute("href", "https://naver.com");

  y.setAttribute("shape", "rect");

  y.setAttribute("coords", "4,3,68,21");

  document.getElementById("hz").appendChild(y);


  document.getElementById("demo").innerHTML = "생성완료. 클릭 가능.";

}

</script>

 

결과보기

 

<map> 객체 집합

 

area

imagemap의 모든 <area> 요소 집합 반환.

 

images

imagemap과 관련된 모든 <img> 및 <object> 요소의 집합 반환. 

 

 

<map> 객체 속성

 

name

imagemap의 name 속성값 설정/반환. 

 

※ <map> 객체는 표준 속성/메서드/이벤트 지원.


분류 제목
DOM_Style JS - animationPlayState 속성 - 애니재생상태 (= 애니작동상태설정 = 움직임 재생/멈춤 …
DOM_Style JS - background 속성 ★ - (배경색/배경이미지) 설정/반환 (= background속성 / 백…
DOM_Style JS - backgroundAttachment 속성 ★ - 배경이미지고정 설정/반환
DOM_Style JS - backgroundColor 속성 ★ - 배경색 설정/반환. (= backgroundColor속성 …
DOM_Style JS - backgroundImage 속성 ★ - 배경이미지 설정/반환 (= backgroundImage속성…
DOM_Style JS - backgroundPosition 속성 - 배경이미지위치 설정/반환
DOM_Style JS - backgroundRepeat 속성 - 배경이미지반복 설정/반환
DOM_Style JS - backgroundClip 속성 - 배경 영역 (= backgroundClip속성 = 백그라운드클립…
DOM_Style JS - backgroundOrigin 속성 - 배경이미지 좌표시작점 설정/반환 (= 백그라운드오리진 속성)
DOM_Style JS - backgroundSize 속성 ★ - 배경이미지크기 설정/반환 (IE9 이상)
DOM_Style JS - backfaceVisibility 속성 - 3D요소 뒷면노출 설정/반환 (IE10 이상)
DOM_Style JS - border 속성 ★ - 테두리스타일 설정/반환 (= 보더속성 = border속성)
DOM_Style JS - borderBottom 속성 - 테두리하단 (= border-bottom속성 = 하단테두리 = 보더…
DOM_Style JS - borderBottomColor 속성 - 테두리하단색깔 (= 보더바텀컬러속성 = border-bot…
DOM_Style JS - borderBottomLeftRadius 속성 - 테두리하단왼쪽모서리둥글게 (= 테두리 하단좌측둥글…
57/89
목록
 홈  PC버전 로그인 일본어
그누앞단언어
그누뒷단언어
그외코딩언어
그누보드
제작의뢰
Q&A
커뮤니티
웹유틸
회원센터
홈짱닷컴 PC버전 로그인