HBCMS更多的中文手册参考:

CONTENTEDITABLE Attribute | contentEditable参数属性

DHTML文档教程

Sets or retrieves the string that indicates whether the user can edit the content of the object.

dhtml语法

HTML<ELEMENT CONTENTEDITABLE = sCanEdit... >
Scriptingobject.contentEditable(v) [ = sCanEdit ]

DHTML可能的值

sCanEditString that specifies or receives one of the following values.
inheritDefault. Content's ability to be edited by user is inherited from object's parent.
falseContent cannot be edited by the user.
trueContent can be edited by the user.

The property is read/write. The property has a default value of inherit.

Remarks

Child elements do not inherit this attribute unless they have layout. Use the haslayout property to determine if an object has layout.

if this attribute is applied to a body element, it has the same effect as setting the designmode property of the document object.

elements with the disabled attribute set to false do not respond to the contenteditable attribute.

if this attribute is applied to the A element, the default functionality of the A element will be lost while sCanEdit is set to the value of true.

If this attribute is applied to the MARQUEE element, the default functionality of the MARQUEE element will be lost while sCanEdit is set to the value of true.

Though the TABLE, COL, COLGROUP, tbody, TD, tfoot, TH, thead, and TR elements cannot be set as content editable directly, a content editable span, or DIV element can be placed inside the individual table cells (TD and TH elements). See the example below.

security note Security Alert  Users can change the contents of a Web page when the contentEditable property is set to TRUE. Using this property incorrectly can compromise the security of your application. Incorrect use of the contentEditable property might include not validating user input. If you do not validate user input, a malicious user can inject control characters or script that can harm your data. You should take routine precautions against displaying unvalidated user input. For more information, see security considerations: dynamic html.

Examples

In the following example, setting the DIV elements to have 100%?A href="../properties/height_1.html">height and width makes all content within the borders of the cells editable.

<P>Table 1 Editable</P><BR/>
<TABLE BORDER=1 WIDTH=80%>
<THEAD>
<TR>
<TH><DIV CONTENTEDITABLE STYLE="height: 100%; width: 100%;">Heading 1 <DIV></TH>
<TH><DIV CONTENTEDITABLE STYLE="height: 100%; width: 100%;">Heading 2 <DIV></TH>
</TR>
</THEAD>
<TBODY>
<TR>
<TD><DIV CONTENTEDITABLE STYLE="height: 100%; width: 100%;">Row 1, Column 1 text.<DIV></TD>
<TD><DIV CONTENTEDITABLE STYLE="height: 100%; width: 100%;">Row 1, Column 2 text.<DIV></TD>
</TR>
<TR>
<TD><DIV CONTENTEDITABLE STYLE="height: 100%; width: 100%;">Row 2, Column 1 text.<DIV></TD>
<TD><DIV CONTENTEDITABLE STYLE="height: 100%; width: 100%;">Row 2, Column 2 text.<DIV></TD>
</TR>
</TBODY>
</TABLE>

The following example shows how to use the contentEditable property to control whether the user can edit the content of the object.

<HEAD>
<SCRIPT>
function chgSpan() {
currentState = oSpan.isContentEditable;
newState = !currentState;
oSpan.contentEditable = newState;
oCurrentValue.innerText = newState;
newState==false ? oBtn.innerText="Enable Editing" :
oBtn.innerText="Disable Editing"
}
</SCRIPT>
</HEAD>
<BODY onload="oCurrentValue.innerText = oSpan.isContentEditable;">
<P>Click the button to enable or disable SPAN content editing.</P>
<P>
<BUTTON ID="oBtn" onclick="chgSpan()">Enable Editing</BUTTON>
</P>
<P><SPAN ID="oSpan">You can edit this text.</SPAN></P>
SPAN can be edited: <SPAN ID="oCurrentValue"></SPAN>
</BODY>
This feature requires Microsoft® Internet Explorer 5.5 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

This example demonstrates the features of Microsoft® Internet Explorer that enable users to edit the content of an HTML element directly from the browser.

This feature requires Microsoft® Internet Explorer 5.5 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

是否符合公共标准

There is no public standard that applies to this property.

Applies To

defaults, A, ACRONYM, ADDRESS, B, BDO, BIG, BLOCKQUOTE, BODY, BUTTON, CENTER, CITE, CODE, CUSTOM, DD, DEL, DFN, DIR, DIV, DL, DT, EM, FIELDSET, FONT, FORM, hn, I, INPUT type=button, INPUT type=password, 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, SMALL, SPAN, STRIKE, STRONG, SUB, SUP, TEXTAREA, TT, U, UL, VAR, XMP