HTMLElement
参考文档:MDN HTMLElement
一、继承关系
- 所有HTML元素都是由HTMLElement或者其更具体的子类型来表示的。
-
二、属性方法
1. HTMLElement的普通属性
-
-
继承自父接口Element的属性
例:innerHTML, className, id
- 自身属性
-
属性名称 |
属性类型 |
Description |
分配给元素的access key |
||
A string that represents the element's assigned access key. |
||
获取/设置元素的可编辑状态 |
||
指示元素的内容是否可被编辑 |
||
允许读写元素的自定义data特性(data-*) |
||
获取/设置元素的方向 |
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
any |
|
|
获取/设置元素属性、文本、内容的语言(Gets/sets the language of an element's attributes, text, and element contents). |
||
double |
The height of an element, relative to the layout. |
|
double |
The distance from this element's left border to its offsetParent's left border. |
|
The element from which all offset calculations are currently computed. |
||
double |
The distance from this element's top border to its offsetParent's top border. |
|
double |
The width of an element, relative to the layout. |
|
|
||
Controls spell-checking (present on all HTML elements) |
||
An object representing the declarations of an element's style attributes. |
||
long |
Gets/sets the position of the element in the tabbing order. |
|
A string that appears in a popup box when mouse is over the element. |
||
|
2. HTMLElement的Event handlers属性
-
- 实现了GlobalEventHandlers的event属性:所有onXYZ形式(如:onClick)
-
自身属性
Returns the event handling code for the touchstart event.
Returns the event handling code for the touchend event.
Returns the event handling code for the touchmove event.
Returns the event handling code for the touchenter event.
Returns the event handling code for the touchleave event.
Returns the event handling code for the touchcancel event.
3. HTMLElement的方法
-
- 继承自父接口Element的方法
- 自身方法
Name & Arguments |
Return |
Description |
void |
从当前已经获得焦点的元素上移除键盘焦点(Removes keyboard focus from the currently focused element). |
|
void |
在该元素上触发click事件(Sends a mouse click event to the element). |
|
void |
让当前元素获取焦点(Makes the element the current keyboard focus). |
|
void |
|