์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ์ด๋ฏธ์ง€ ๋งต

์ด๋ฏธ์ง€ ๋งต์ด๋ž€ ๋ญ˜๊นŒ์š”?

์•„๋ž˜ ์˜ˆ์ œ๋Š” ์ด๋ฏธ์ง€์˜ ํŠน์ • ์˜์—ญ์— ๋งˆ์šฐ์Šค๋ฅผ ์˜ฌ๋ ค๋†“์œผ๋ฉด ํŠน์ • ๊ธฐ๋Šฅ์ด ์‹คํ–‰์ด ๋˜๊ณ  ํด๋ฆญ์„ ํ•˜๋ฉด ํŠน์ • URL๋กœ ์ด๋™์‹œ์ผœ์ฃผ๋„๋ก ๋˜์–ด์žˆ์Šต๋‹ˆ๋‹ค.

์†Œ์Šค๋ฅผ ๋ณด์‹œ๋ฉด <map>๊ณผ <area>ํƒœ๊ทธ๊ฐ€ ์‚ฌ์šฉ๋œ ๊ฒƒ์ด ๋ณด์ด๋Š”๊ตฐ์š”.

<area>์—์„œ๋Š” ์˜์—ญ์„ ์ง€์ •ํ•ด์ฃผ๊ณ  ์˜์—ญ๋‚ด์—์„œ ์ผ์–ด๋‚˜๋Š” ์ด๋ฒคํŠธ์— ๋Œ€ํ•ด์„œ ์–ด๋–ค ๊ธฐ๋Šฅ์„ ์‹คํ–‰ํ• ์ง€ ์ง€์ •ํ•ด์ฃผ๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

๊ทธ๋ฆฌ๊ณ  ์ด ํƒœ๊ทธ๋“ค์„ <map>ํƒœ๊ทธ๊ฐ€ ๊ฐ์‹ธ๊ณ  ์žˆ๋Š” ํ˜•ํƒœ๊ตฐ์š”.

์‹คํ–‰ํ•ด๋ณด์‹œ๋ฉด ์ดํ•ด๊ฐ€ ์ž˜ ๋ ๊ฒ๋‹ˆ๋‹ค.

<area>ํƒœ๊ทธ์—์„œ coords๋Š” ์˜์—ญ์„ ๋‚˜ํƒ€๋‚ด๋Š” ํฌ์ง€์…˜์„ ๋งํ•ฉ๋‹ˆ๋‹ค.

poly์—์„œ๋Š” ์—ฐ์†๋˜๋Š” ๋‘๊ฐœ์˜ ์ˆซ์ž๊ฐ€ ํ•œ ์ ์˜ ์œ„์น˜๋ฅผ ์ง€์ •ํ•ด์ค๋‹ˆ๋‹ค.

์•„๋ž˜ ์˜ˆ์ œ์—์„œ๋Š” 10๊ฐœ์˜ ์ˆซ์ž๊ฐ€ ์žˆ์œผ๋‹ˆ ์ด 5๊ฐœ์˜ ์ ์œผ๋กœ ํ‘œํ˜„๋˜๊ฒ ๊ตฐ์š”.

rect์—์„œ๋Š” ์‚ฌ๊ฐํ˜•์„ ๊ทธ๋ฆฌ๊ธฐ์œ„ํ•œ ๋„ค๊ฐœ์˜ ์ˆซ์ž๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

๊ฐ€์žฅ ์™ผ์ชฝ ์•„๋ž˜์˜ ์ ์˜ ์ขŒํ‘œ์™€ ๊ทธ ์ ์˜ ๋Œ€๊ฐ์„ ์— ์œ„์น˜ํ•œ ์ ์˜ ์ขŒํ‘œ๊ฒ ์ฃ .

circle์—์„œ๋Š” ์›์„ ๋‚˜ํƒ€๋‚ด๊ธฐ์œ„ํ•œ ์„ธ๊ฐœ์˜ ์ˆซ์ž๊ฐ€ ์žˆ๋„ค์š”.

์ค‘์‹ฌ์  ์ขŒํ‘œ(์ˆซ์ž 2๊ฐœ)์™€ ๋ฐ˜์ง€๋ฆ„์˜ ๊ฐ’์ธ ๊ฒƒ ๊ฐ™๋„ค์š”.

์ขŒํ‘œ๋ฅผ ํ•˜๋“œ์ฝ”๋”ฉํ•˜์ง€ ์•Š๋Š” ๋ฐฉ๋ฒ•์„ ์ƒ๊ฐํ•ด์„œ ๊ตฌํ˜„ํ•˜๋ฉด ์“ธ๋งŒํ•  ๊ฒƒ๋„ ๊ฐ™๋„ค์š”.

 

<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>

 

์‹ค์ œ ๋™์ž‘ํ•˜๋Š” ๋ชจ์Šต์€ tutorialspoint ์‚ฌ์ดํŠธ์—์„œ ํ™•์ธ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

 

 

 

Reference : http://www.tutorialspoint.com/javascript/javascript_image_map.htm