HTML DOM 입력 날짜 readOnly 속성은 입력 날짜를 수정할 수 있는지 여부를 설정/반환합니다.
구문
다음은 구문입니다 -
- 부울 값 반환 - true/false
inputDateObject.readOnly
- 읽기 전용 설정 booleanValue로
inputDateObject.readOnly = booleanValue
부울 값
여기서 "booleanValue"는 다음과 같을 수 있습니다. -
| 부울 값 | 세부정보 |
|---|---|
| 사실 | 입력 날짜가 읽기 전용임을 정의합니다. |
| 거짓 | 입력 날짜가 읽기 전용이 아니며 수정할 수 있음을 정의합니다. |
예시
입력 날짜 읽기 전용의 예를 살펴보겠습니다. 속성 -
<!DOCTYPE html>
<html>
<head>
<title>Input Date readOnly</title>
</head>
<body>
<form>
Final Exam Date: <input type="date" id="dateSelect">
</form>
<button onclick="finalizeDate()">Confirm Date</button>
<div id="divDisplay"></div>
<script>
var divDisplay = document.getElementById("divDisplay");
var inputDate = document.getElementById("dateSelect");
divDisplay.textContent = 'Exam Date Finalized: '+inputDate.readOnly;
function finalizeDate() {
inputDate.readOnly = true;
divDisplay.textContent = 'Exam Date: '+inputDate.value;
}
</script>
</body>
</html> 출력
이것은 다음과 같은 출력을 생성합니다 -
'날짜 확인'을 클릭하기 전에 버튼 -

'날짜 확인'을 클릭한 후 버튼 -
