Sets or retrieves the status of the object. dhtml语法 HTML | <ELEMENT DISABLED
... >
|
---|
Scripting | object.disabled [ = bDisabled ] |
---|
DHTML可能的值 bDisabled | Boolean that
specifies or receives one of the following values.false | Default. Element is not disabled. | true | Element 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.
DHTML代码范例
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.
是否符合公共标准
This property is defined in
HTML 4.0 and
is defined in
World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 .
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,
STYLE,
SUB,
SUP,
TEXTAREA,
TT,
U,
UL,
VAR,
XMP | |
更多语法参考 disabled
|