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

  

   

posted @ 2017-03-29 09:56  妙音天女  阅读(1327)  评论(0编辑  收藏  举报