HTMLElement

参考文档:MDN HTMLElement

 

一、继承关系

  1. 所有HTML元素都是由HTMLElement或者其更具体的子类型来表示的。
  2. HTMLElement 继承自 Element ,并实现了 GlobalEventHandlersTouchEventHandlers.

       

二、属性方法

1. HTMLElement的普通属性

    • 继承自父接口Element 的属性

      例:innerHTML, className, id

    • 自身属性

属性名称

属性类型

Description

HTMLElement.accessKey

DOMString

分配给元素的access key

HTMLElement.accessKeyLabel

DOMString

A string that represents the element's assigned access key.

HTMLElement.contentEditable

DOMString

获取/设置元素的可编辑状态

HTMLElement.isContentEditable 只读

Boolean

指示元素的内容是否可被编辑

HTMLElement.dataset 只读

DOMStringMap

允许读写元素的自定义data特性(data-*)

HTMLElement.dir

DOMString

获取/设置元素的方向

HTMLElement.draggable

Boolean

  

HTMLElement.dropzone 只读

DOMSettableTokenList

  

HTMLElement.hidden

Boolean

  

HTMLElement.itemScope 

Boolean

  

HTMLElement.itemType 只读

DOMSettableTokenList

  

HTMLElement.itemId 

DOMString

  

HTMLElement.itemRef 只读

DOMSettableTokenList

  

HTMLElement.itemProp 只读

DOMSettableTokenList

  

HTMLElement.itemValue 

any

  

HTMLElement.lang

DOMString

获取/设置元素属性、文本、内容的语言(Gets/sets the language of an element's attributes, text, and element contents).

HTMLElement.offsetHeight 只读

double

The height of an element, relative to the layout.

HTMLElement.offsetLeft只读

double

The distance from this element's left border to its offsetParent's left border.

HTMLElement.offsetParent只读

Element

The element from which all offset calculations are currently computed.

HTMLElement.offsetTop只读

double

The distance from this element's top border to its offsetParent's top border.

HTMLElement.offsetWidth只读

double

The width of an element, relative to the layout.

HTMLElement.properties 只读

HTMLPropertiesCollection

  

HTMLElement.spellcheck

Boolean

Controls spell-checking (present on all HTML elements)

HTMLElement.style

CSSStyleDeclaration

An object representing the declarations of an element's style attributes.

HTMLElement.tabIndex

long

Gets/sets the position of the element in the tabbing order.

HTMLElement.title

DOMString

A string that appears in a popup box when mouse is over the element.

HTMLElement.translate 

Boolean

  

   

2. HTMLElement的Event handlers属性

3. HTMLElement的方法

    • 继承自父接口Element的方法
    • 自身方法

Name & Arguments

Return

Description

HTMLElement.blur()

void

从当前已经获得焦点的元素上移除键盘焦点(Removes keyboard focus from the currently focused element).

HTMLElement.click()

void

在该元素上触发click事件(Sends a mouse click event to the element).

HTMLElement.focus()

void

让当前元素获取焦点(Makes the element the current keyboard focus).

HTMLElement.forceSpellCheck()

void

  

   

转载于:https://www.cnblogs.com/xuehaoyue/p/6638196.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值