• 회원가입
  • 로그인
  • 구글아이디로 로그인

[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> 객체는 표준 속성/메서드/이벤트 지원.


분류 제목
HTML_Objects JS - <ol> 객체 ★ - 순서있는리스트 (= 목록태그 = ol태그 = 오엘태그 = 올태그 = 오더드 리…
HTML_Objects JS - <optgroup> 객체 - 옵션그룹 (= optgroup태그 = 옵트그룹태그/옵션그룹태그) ※ 선…
HTML_Objects JS - <option> 객체 ★ - 선택사항 (= 옵션사항 = option태그 = 옵션태그)
HTML_Objects JS - <output> 객체 - 계산결과값출력 (= 산출태그 = output태그 = 아웃풋태그) (HTML…
HTML_Objects JS - <p> 객체 - 글단락 (= p태그 = p요소 = 글문단 = 단락태그 = 문단태그 = 피태그)
HTML_Objects JS - <param> 객체 - 미디어매개변수 (= param태그 = 패럼태그 = 파람태그 = 패러미터태그 …
HTML_Objects JS - <pre> 객체 ★ - 공백줄바꿈보존 (= 보존태그 = 있는그대로태그 = 있는대로태그 = pre태그…
HTML_Objects JS - <progress> 객체 - 진행상태바 (=진행바 = 진행막대 = 작업막대 = progress태그 …
HTML_Objects JS - <q> 객체 - 짧은인용구 (= 짧은인용태그 = q태그 = 큐태그)
HTML_Objects JS - <s> 객체 - 취소선 (= 취소태그 = s태그 = 에스태그 = 스트라이크쓰루태그) (HTML5 재…
HTML_Objects JS - <samp> 객체 - 프로그램산출예제 (= 예제태그 = samp태그 = 샘프태그 = 샘플태그)
HTML_Objects JS - <script> 객체 ★ - JS코드입력 (= 동적기능언어입력 = script태그 = 스크립트태그)
HTML_Objects JS - <section> 객체 ★ - 문서단락 (= section태그 = 섹션태그, IE9)
HTML_Objects JS - <select> 객체 ★★ - 선택메뉴 (= select메뉴 = select태그 = 실렉트태그/셀렉…
HTML_Objects JS - <small> 객체 - 작은글씨 (= small태그 = 스몰태그)
HTML_Objects JS - <source> 객체 - 미디어소스 불러오기 (= source태그 = 소스태그, IE9)
HTML_Objects JS - <span> 객체 ★★★ - 인라인요소그룹 (= span태그 = 스팬태그)</span>
HTML_Objects JS - <strong> 객체 ★ - 굵은 글씨 (=폰트 굵게 = 글씨 굵게 = strong태그 = 스트롱태…
HTML_Objects JS - <style> 객체 ★ - 요소에 CSS스타일적용 (= style태그 = 스타일태그)
HTML_Objects JS - <sub> 객체 ★ - 아래첨자 (= 하단작은글씨 = 하단태그 = sub태그 = 서브태그)
5/6
목록
찾아주셔서 감사합니다. Since 2012