Search DaTutorials:  
HOME
DHTML Reference
Introduction
Reference

DISABLED Attribute | disabled Property


Sets or retrieves the status of the object.

Syntax

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

Possible Values

bDisabledBoolean that specifies or receives one of the following values.
falseDefault. Element is not disabled.
trueElement is disabled.

The property is read/write. The property has 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 About Dynamic Properties.

Remarks

When an element is disabled, it appears dimmed and does not respond to user input. Disabled elements do not respond to mouse events, nor will they respond to the contentEditable property.

If an element's disabled property is set to false but it is contained within a disabled element, it cannot override the disabled state of its container.

Example

This example uses the disabled property to enable or disable a style object and a control.

<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 Microsoft® Internet Explorer 4.0 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

Standards Information

property is defined in HTML 4.0 Non-Microsoft link and defined in World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 Non-Microsoft link.

Applies To

defaults, A, ACRONYM, ADDRESS, B, BDO, BIG, BLOCKQUOTE, BODY, BUTTON, CAPTION, CENTER, CITE, CODE, CUSTOM, DD, DEL, DFN, DIR, DIV, DL, DT, EM, FIELDSET, FONT, FORM, hn, I, 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, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, INS, ISINDEX, KBD, LABEL, LEGEND, LI, LISTING, MARQUEE, MENU, NOBR, OL, P, PLAINTEXT, PRE, Q, RT, RUBY, S, SAMP, SELECT, SMALL, STRIKE, STRONG, SUB, SUP, TEXTAREA, TT, U, UL, VAR, XMP

See Also

disabled

     Internet Advertising | Online Advertising | Advertising | Internet Advertising | Online Advertising
Home    Link To Us    Ad With Us    Contact Us    Tell A Friend    Affiliates    Blog    Stock Photos