HTML DOM 입력 주 양식 속성은 입력 주에 대한 둘러싸는 양식의 참조를 반환합니다.
구문
다음은 구문입니다 -
양식에 대한 참조 반환 개체
inputWeekObject.form
예시
주 입력 양식의 예를 살펴보겠습니다. 속성 -
<!DOCTYPE html>
<html>
<head>
<title>Input Week 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>Week-form</legend>
<label for="WeekSelect">Examination Week:
<input type="week" id="WeekSelect" 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 inputWeek = document.getElementById("WeekSelect");
function showExamination() {
divDisplay.textContent = 'Examinations: '+inputWeek.form.id;
}
</script>
</body>
</html> 출력
이것은 다음과 같은 출력을 생성합니다 -
'이번 주에 어떤 시험이 있나요?'를 클릭하기 전에 버튼 -

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