Friday, November 2, 2012

disabled

Properti HTMLSelectElement.disabled menetapkan atau mengembalikan atribut DISABLED elemen SELECT HTML.

Sintaks:

selectObj.disabled = value selectObj.disabled

value adalah boolean, true atau false.

Contoh di bawah ini mengembalikan nilai atribut DISABLED:

<FORM> <SELECT> <OPTION>0</OPTION> <OPTION>1</OPTION> <OPTION>2</OPTION> </SELECT> </FORM> <SCRIPT TYPE="text/javascript"> var selectObj = document.getElementsByTagName("select")[0]; alert(selectObj.disabled); // false </SCRIPT>

Contoh di bawah ini menetapkan atribut DISABLED:

<FORM> <SELECT> <OPTION>0</OPTION> <OPTION>1</OPTION> <OPTION>2</OPTION> </SELECT> </FORM> <SCRIPT TYPE="text/javascript"> var selectObj = document.getElementsByTagName("select")[0]; selectObj.disabled = true; </SCRIPT>

Elemen SELECT di atas akan menjadi:

<SELECT DISABLED>