HTML DOM Input Time readOnly प्रॉपर्टी सेट/लौटाती है कि इनपुट टाइम को संशोधित किया जा सकता है या नहीं।
सिंटैक्स
निम्नलिखित सिंटैक्स है:
बूलियन मान प्राप्त करना - true/false
inputTimeObject.readOnly
readOnly को booleanValue पर सेट करना
inputTimeObject.readOnly = booleanValue
बूलियन मान (Boolean Values)
यहां "booleanValue" निम्नलिखित हो सकते हैं:
| booleanValue | विवरण |
|---|---|
| true | यह परिभाषित करता है कि इनपुट टाइम फील्ड रीड-ओनली है। |
| false | यह परिभाषित करता है कि इनपुट टाइम फील्ड रीड-ओनली नहीं है और इसे संशोधित किया जा सकता है। |
उदाहरण
आइए Input Time readOnly प्रॉपर्टी का एक उदाहरण देखें:
<!DOCTYPE html> <html> <head> <title>Input Time readOnly</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>Time-readOnly</legend>
<label for="TimeSelect">Appointment with Supervisor:</label>
<input type="time" id="TimeSelect" value="12:45" readOnly>
<input type="button" onclick="changeMeeting()" value="Edit Time">
<div id="divDisplay"></div>
</fieldset>
</form>
<script>
var divDisplay = document.getElementById("divDisplay");
var inputTime = document.getElementById("TimeSelect");
function changeMeeting() {
if(inputTime.readOnly === true)
divDisplay.textContent = 'The meeting time cannot be altered';
else
divDisplay.textContent = 'The meeting time fixed at: '+inputTime.value;
}
</script> </body> </html>
आउटपुट
यह निम्नलिखित आउटपुट उत्पन्न करेगा:
'Edit Time' बटन पर क्लिक करने से पहले:

'Edit Time' बटन पर क्लिक करने के बाद:
