HTML의 HTML DOM 범례 개체는
구문
다음은 구문입니다 -
<범례> 만들기 요소
var legendObject = document.createElement(“LEGEND”)
속성
여기 "LegendObject" 다음과 같은 속성을 가질 수 있습니다 -
| 속성 | 설명 |
|---|---|
| 양식 | 범례 요소를 포함하는 둘러싸는 형식의 참조를 반환합니다. |
예시
범례 형식의 예를 살펴보겠습니다. 속성 -
<!DOCTYPE html>
<html>
<head>
<title>Legend form</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 id="Mid-Term">
<fieldset>
<legend id="legendForm">Legend-form</legend>
<label for="WeekSelect">Examination Week:
<input type="week" value="2019-W36">
</label>
<input type="button" onclick="showExamination()" value="What exams are in this week? ">
<div id="divDisplay"></div>
</fieldset>
</form>
<script>
var divDisplay = document.getElementById("divDisplay");
var legendForm = document.getElementById("legendForm");
function showExamination() {
divDisplay.textContent = 'Examinations: '+legendForm.form.id;
}
</script>
</body>
</html> 출력
이것은 다음과 같은 출력을 생성합니다 -
'이번 주에 어떤 시험이 있나요?'를 클릭하기 전에 버튼 -

'이번 주에 어떤 시험이 있나요?'를 확인한 후 버튼 -
