Properti HTMLInputElement.disabled
menetapkan atau mengembalikan atribut DISABLED elemen INPUT HTML.
Sintaks:
inputObj.disabled = value
inputObj.disabled
value adalah boolean, yaitu true
atau false
.
Contoh di bawah ini mengembalikan nilai atribut DISABLED elemen INPUT ber-TYPE 'file':
<FORM METHOD="POST" ACTION="yourCGIURL">
Image to be uploaded:<BR>
<INPUT TYPE="file" SIZE="40" NAME="imageToGo" ACCEPT="image/gif,image/jpeg" DISABLED>
<INPUT TYPE="submit" VALUE="Submit">
</FORM>
<SCRIPT TYPE="text/javascript">
var inputObj = document.getElementsByTagName("input")[0];
alert(inputObj.disabled); // true
</SCRIPT>
Contoh di bawah ini menetapkan atribut DISABLED kepada elemen INPUT ber-TYPE 'file':
<FORM METHOD="POST" ACTION="yourCGIURL">
Image to be uploaded:<BR>
<INPUT TYPE="file" SIZE="40" NAME="imageToGo" ACCEPT="image/gif,image/jpeg">
<INPUT TYPE="submit" VALUE="Submit">
</FORM>
<SCRIPT TYPE="text/javascript">
var inputObj = document.getElementsByTagName("input")[0];
inputObj.disabled = true;
</SCRIPT>
Elemen INPUT ber-TYPE 'file' di atas akan menjadi:
<INPUT TYPE="file" SIZE="40" NAME="imageToGo" ACCEPT="image/gif,image/jpeg" DISABLED>