Sets or retrieves the status of a control or style.
Syntax
HTML <ELEMENT DISABLED = bDisabled ... > Scripting object.disabled [ = bDisabled ]
Possible Values
bDisabled Boolean that specifies one of the following values:
false Control or style is not disabled. true Control or style is disabled. The property is read/write with a default value of false.
Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see Dynamic Properties.
Remarks
When a control is disabled it appears dimmed and does not respond to user input. When a style is disabled, all of the rules no longer render.
The disabled property applies to the STYLE object, not the style property.
Example
This example uses the disabled property to enable or disable a STYLE object and a control.
Sample Code
<STYLE ID=oStyle> .styletest{background-color: black; color: white;} .styletest2{background-color: black; color: red;} </STYLE> <SCRIPT> function fnSwitch(){ if(oParagraph.enablement == "enabled"){ // Use an arbitrary attribute to track the status. oParagraph.enablement = "disabled"; oButton.value = "Set disabled to false"; oStyle.disabled = true; oDisableMe.disabled = true; } else{ oButton.value = "Set disabled to true"; oParagraph.enablement = "enabled"; oStyle.disabled = false; oDisableMe.disabled = false; } } </SCRIPT> : <P enablement = "enabled" ID = oParagraph CLASS = "styletest"> A paragraph of text. <INPUT TYPE = button ID = oDisableMe CLASS = "styletest" VALUE = "Demonstration Button" onclick = "alert('Demonstration button')"> </P> <INPUT TYPE=button ID=oButton VALUE="Set disabled to true" onclick="fnSwitch()">
Applies To