DISABLED Attribute | disabled Property

DHTML, HTML, & CSS

DISABLED Attribute | disabled Property


Sets or retrieves the status of a control or style.

Syntax

HTML<ELEMENT DISABLED = bDisabled ... >
Scriptingobject.disabled [ = bDisabled ]

Possible Values

bDisabled Boolean that specifies one of the following values:
falseControl or style is not disabled.
trueControl 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 propertiesInternet Link.

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()">
This feature requires Internet Explorer 4.0 or later. Click the icon below to install the latest version. Then reload this page to view the sample.
Microsoft Internet Explorer

Applies To

[ Object Name ]
PlatformVersion
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

Back to topBack to top

Did you find this topic useful? Suggestions for other topics? write us!Internet Link

© 1999 microsoft corporation. all rights reserved. terms of useInternet Link.