HTML의 HTML DOM 지도 개체는 을 나타냅니다. 요소.
구문
다음은 구문입니다 -
<지도> 만들기 요소
var mapObject = document.createElement(“MAP”)
속성
여기, "mapObject" 다음 컬렉션 및 속성을 가질 수 있습니다 -
| 컬렉션/속성 | 설명 |
|---|---|
| 영역 | 모든 컬렉션을 반환합니다. 요소 |
| 이미지 | 모든 |
| 이름 | 의 name 속성 값을 설정/반환합니다. |
예시
지도 영역의 예를 살펴보겠습니다. 컬렉션 -
<!DOCTYPE html>
<html>
<head>
<title>Map areas collection</title>
<style>
form {
width:70%;
margin: 0 auto;
text-align: center;
}
* {
padding: 2px;
margin:5px;
}
input[type="button"] {
border-radius: 10px;
}
</style>
</head>
<body>
<form>
<fieldset>
<legend>Map-areas-collection</legend>
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/f/fb/New7Wonders.jpg/276px-New7Wonders.jpg" width="250" height="150" usemap="#7Wonders">
<map id="WonderWorld" name="7Wonders">
</map>
<div id="divDisplay"></div>
<input type="button" value="Apply Link" onclick="myWonder()">
</fieldset>
</form>
<script>
function myWonder() {
var divDisplay = document.getElementById("divDisplay");
var newArea = document.createElement("AREA");
newArea.setAttribute("href", "https://en.wikipedia.org/wiki/Giza_pyramid_complex");
newArea.setAttribute("shape", "rect");
newArea.setAttribute("coords", "120,10,10,40");
document.getElementById("WonderWorld").appendChild(newArea);
divDisplay.textContent = "Link was applied, hover and click on pyramid of giza.";
}
</script>
</body>
</html> 출력
이것은 다음과 같은 출력을 생성합니다 -
'링크 적용'을 클릭하기 전에 버튼 -

'링크 적용'을 클릭한 후 버튼 -
