HTML的contentEditable属性

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

Syntax

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

Possible Values

sCanEdit String that specifies or receives one of the following values.
inherit Default. Content's ability to be edited by user is inherited from object's parent.
false Content cannot be edited by the user.
true Content 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.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值