HTMLElement
Интерфейс HTMLElement
представляет собой любой элемент HTML. Некоторые элементы напрямую используют этот интерфейс, другие - через промежуточный интерфейс.
Свойства
Наследует свойства родителя, Element
, и реализует их через GlobalEventHandlers
и TouchEventHandlers
.
HTMLElement.accessKey
— ключ доступа-
Эта строковая переменная
DOMString
отображает ключ доступа, сопоставленный элементуElement
. HTMLElement.accessKeyLabel
(en-US) Только для чтения-
Возвращает
DOMString
, содержащий назначенный ключ доступа элемента. HTMLElement.contentEditable
-
Является
DOMString
, где значение" true "означает, что элемент доступен для редактирования, а значение" false " означает, что это не так. HTMLElement.isContentEditable
(en-US) Только для чтения-
Возвращает
Boolean
(en-US), который указывает, можно ли редактировать содержимое элемента. -
Является
HTMLMenuElement
(en-US), представляющим контекстное меню, связанное с элементом. Может быть null HTMLElement.dataset
(en-US) Только для чтения — набор данных-
Возвращает
domstringmap
, который позволяет получить доступ к чтению и записи атрибутов пользовательских данных элемента (data-*) . HTMLElement.dir
(en-US)-
Is a
DOMString
, reflecting thedir
global attribute, representing the directionality of the element. Possible values are"ltr"
,"rtl"
, and"auto"
. HTMLElement.draggable
-
Is a
Boolean
indicating if the element can be dragged. HTMLElement.dropzone
Только для чтения-
Returns a
DOMSettableTokenList
reflecting thedropzone
global attribute and describing the behavior of the element regarding a drop operation. -
Is a
Boolean
indicating if the element is hidden or not. HTMLElement.itemScope
Экспериментальная возможность-
Is a
Boolean
… HTMLElement.itemType
Только для чтения Экспериментальная возможность-
Returns a
DOMSettableTokenList
… HTMLElement.itemId
Экспериментальная возможность-
Is a
DOMString
… HTMLElement.itemRef
Только для чтения Экспериментальная возможность-
Returns a
DOMSettableTokenList
… HTMLElement.itemProp
Только для чтения Экспериментальная возможность-
Returns a
DOMSettableTokenList
… HTMLElement.itemValue
Экспериментальная возможность-
Returns an
Object
… HTMLElement.lang
(en-US)-
Is a
DOMString
representing the language of an element's attributes, text, and element contents. HTMLElement.offsetHeight
Только для чтения Экспериментальная возможность-
Returns a
double
containing the height of an element, relative to the layout. HTMLElement.offsetLeft
Только для чтения Экспериментальная возможность-
Returns a
double
, the distance from this element's left border to itsoffsetParent
's left border. HTMLElement.offsetParent
(en-US)Только для чтения Экспериментальная возможность-
Returns an
Element
that is the element from which all offset calculations are currently computed. HTMLElement.offsetTop
Только для чтения Экспериментальная возможность-
Returns a
double
, the distance from this element's top border to itsoffsetParent
's top border. HTMLElement.offsetWidth
Только для чтения Экспериментальная возможность-
Returns a
double
containing the width of an element, relative to the layout. HTMLElement.properties
Только для чтения Экспериментальная возможность-
Returns an
HTMLPropertiesCollection
… HTMLElement.spellcheck
-
Is a
Boolean
that controls spell-checking (en-US). It is present on all HTML elements, though it hasn't an effect on all of them. HTMLElement.style
(en-US)-
Is
CSSStyleDeclaration
, an object representing the declarations of an element's style attributes. HTMLElement.tabIndex
(en-US)-
Is a
long
representing the position of the element in the tabbing order. HTMLElement.title
(en-US)-
Is a
DOMString
containing the text that appears in a popup box when mouse is over the element. HTMLElement.translate
Экспериментальная возможность-
Is a
Boolean
Event handlers
Most events properties, of the form onXYZ
, are defined on the GlobalEventHandlers
or TouchEventHandlers
, implemented by HTMLElement
. A few more are specific to HTMLElement
.
HTMLElement.oncopy
(en-US) Non-standard-
Returns the event handling code for the
copy
event (баг 280959). HTMLElement.oncut
(en-US) Non-standard-
Returns the event handling code for the
cut
event (баг 280959). HTMLElement.onpaste
(en-US) Non-standard-
Returns the event handling code for the
paste
event (баг 280959). TouchEventHandlers.ontouchstart
Non-standard-
Returns the event handling code for the
touchstart (en-US)
event. TouchEventHandlers.ontouchend
Non-standard-
Returns the event handling code for the
touchend (en-US)
event. TouchEventHandlers.ontouchmove
Non-standard-
Returns the event handling code for the
touchmove (en-US)
event. TouchEventHandlers.ontouchenter
Non-standard-
Returns the event handling code for the
touchenter
event. TouchEventHandlers.ontouchleave
Non-standard-
Returns the event handling code for the
touchleave
event. TouchEventHandlers.ontouchcancel
Non-standard-
Returns the event handling code for the
touchcancel (en-US)
event.
Methods
Inherits methods from its parent, Element
.
HTMLElement.blur()
(en-US)-
Removes keyboard focus from the currently focused element.
HTMLElement.click()
-
Sends a mouse click event to the element.
HTMLElement.focus()
(en-US)-
Makes the element the current keyboard focus.
HTMLElement.forceSpellCheck()
(en-US) Экспериментальная возможность-
Makes the spell checker runs on the element.
Specifications
Specification |
---|
HTML Standard # htmlelement |
Browser compatibility
BCD tables only load in the browser