DISABLED Attribute | disabled Property
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
[ Object Name ] Platform Version Win16: Win32: Mac: Unix: WinCE: Version data is listed when the mouse hovers over a link, or the link has focus. APPLET, BUTTON, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, LINK, SELECT, TEXTAREA
Did you find this topic useful? Suggestions for other topics? write us!
© 1999 microsoft corporation. all rights reserved. terms of use.