HTML DOM 범례 양식 속성은 범례 태그에 대한 둘러싸는 양식의 참조를 반환합니다.
구문
다음은 구문입니다 -
양식에 대한 참조 반환 개체
legendObject.form
예시
범례 형식의 예를 살펴보겠습니다. 속성 -
<!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> 출력
이것은 다음과 같은 출력을 생성합니다 -
'이번 주에 어떤 시험이 있나요?' 를 클릭하기 전에 버튼 -

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