element

  • Raccourci de la révision : DOM/element
  • Titre de la révision : element
  • ID de la révision : 116108
  • Créé :
  • Créateur : BenoitL
  • Version actuelle ? Non
  • Commentaire /* Méthodes */ getElementsByTagName traduit

Contenu de la révision

Introduction

Ce chapitre fournit une brève référence pour toutes les méthodes, propriétés et évènements disponibles pour tous les élements HTML et XML dans le DOM des navigateurs utilisant Gecko.

Ces interfaces DOM sont réparties sur les différents niveaux de spécification du DOM, mais font pour la plupart partie de la recommandation DOM Level 2. Chaque membre fournit un lien vers sa définition dans les spécifications DOM du W3C.

Ici, le mot « Elements » se réfère à l'interface que tous les éléments HTML et XML ont en commun depuis le DOM. Il y a des interfaces plus spécialisées pour des objets particuliers, par exemple l'élément BODY qui dispose de fonctions et propriétés supplémentaires, ou encore les tableaux. Mais ce chapitre ne concerne que les interfaces partagées par tous les éléments.

Propriétés

attributes
Returns an array of the attributes on the element.
childNodes
Returns an array of the child nodes on the element.
className
Gets/sets the class of the element.
clientHeight
DHTML property that represents the inner height of an element.
clientWidth
DHTML property that represents the inner width of an element.
dir
Gets/sets the directionality of the element.
firstChild
Returns the first direct child of the current node.
id
Gets/sets the id of the current element.
innerHTML
innerHTML returns all of the markup and content within a given element.
lang
Specifies the base language of an element's attribute values and text content.
lastChild
Returns the last child of the current node.
length
Returns the number of items in a list (e.g. childNodes).
localName
localName returns the local part of the qualified name of this node.
namespaceURI
The namespace URI of this node, or NULL if it is unspecified.
nextSibling
Returns the node immediately following the current one in the tree.
nodeName
Returns the name of the current node.
nodeType
Returns the type of the current node.
nodeValue
Returns the value of the current node.
offsetHeight
offsetHeight is a DHTML property that gets the height of an element relative to the layout.
offsetLeft
offsetLeft gets/sets the number of pixels that the current element is offset to the left within the offsetParent node.
offsetParent
offsetParent returns a reference to the object in which the current element is offset (i.e., the parent element).
offsetTop
offsetTop returns the position of the current element relative to the top of the offsetParent node.
offsetWidth
offsetWidth is a DHTML property that gets the width of an element relative to the layout.
ownerDocument
Returns the document in which this node appears.
parentNode
Returns the parent node of the current node.
prefix
prefix returns the namespace prefix of the current node, or NULL if it is unspecified.
previousSibling
Returns the node immediately previous to the current one in the tree.
scrollHeight
DHTML property that gets the height of the scroll view of an element.
scrollTop
DHTML property that sets or gets the distance between the top of an element and the topmost portion of its content currently visible.
style
style returns the block of style rules on the current element.
tabIndex
Gets/sets the position of the element in the tabbing order.
tagName
tagName returns the name of the element.
title
title returns the title of the document.

Méthodes

addEventListener
addEventListener allows the registration of event listeners on the event target.
appendChild
The appendChild method inserts the specified node into the list of nodes on the current document.
blur
The blur method removes keyboard focus from the current element.
click
The click method excecutes a click on the current element.
cloneNode
The cloneNode method returns a duplicate of the current node.
createAttribute
The createAttribute method creates a new attribute on the current element.
dispatchEvent
The dispatchEvent method allows the dispatch of events into the implementation's event model.
focus
focus sets focus on the current element.
getAttribute
getAttribute returns the value of the named attribute on the current node.
getAttributeNS
getAttributeNS returns the value of the attribute with the given name and namespace.
getAttributeNode
Returns the attribute of the current element as a separate node.
getElementsByTagName
Renvoie les éléments portant un nom particulier et faisant partie des enfants de l'élément courant.
hasAttribute
hasAttribute returns a boolean value indicating whether the current element has the specified attribute or not.
hasAttributeNS
hasAttribute is a boolean value indicating whether the current element has an attribute with the specified name and namespace.
hasAttributes
hasAttribute is a boolean value indicating whether the current element has any attributes.
hasChildNodes
hasChildNodes is a boolean value indicating whether the current element has children or not.
insertBefore
The insertBefore method allows you to insert a node before the current element in the DOM.
item
The item method retrieves a node from the tree by index.
normalize
The normalize method puts the current node and all of its subtree into a "normalized" form (see below).
removeAttribute
The removeAttribute() method removes an attribute from the current element.
removeAttributeNode
removeAttributeNode removes the specified attribute from the current element.
removeChild
The removeChild() method removes a child node from the current element.
removeEventListener
removeEventListener() allows the removal of event listeners from the event target.
replaceChild
The replaceChild() method replaces one child node on the current element with another.
setAttribute
setAttribute adds a new attribute or changes the value of an existing attribute on the current element.
setAttributeNS
setAttributeNS adds a new attribute or changes the value of an attribute with the given namespace and name.
setAttributeNode
setAttributeNode adds a new attribute node to the current element.
setAttributeNodeNS
setAttributeNodeNS adds a new attribute node with the specified namespace and name.
supports
The supports method tests if this DOM implementation supports a particular feature.

Évènements

Ces propriétés des éléments ne peuvent pas être assignées de la même manière que les gestionnaires d'évènements sur les objets document et window. Toutes les propriétés des évènements suivants sont en lecture seule, et sont faites pour renvoyer le code de gestion d'évènement, si applicable, qui a déjà été ajouté à l'élément au sein du code HTML ou XML lui-même.

onblur
Returns the event handling code for the blur event.
onclick
Returns the event handling code for the click event.
ondblclick
Returns the event handling code for the dblclick event.
onfocus
Returns the event handling code for the focus event.
onkeydown
Returns the event handling code for the keydown event.
onkeypress
Returns the event handling code for the keypress event.
onkeyup
Returns the event handling code for the keyup event.
onmousedown
Returns the event handling code for the mousedown event.
onmousemove
Returns the event handling code for the mousemove event.
onmouseout
Returns the event handling code for the mouseout event.
onmouseover
Returns the event handling code for the mouseover event.
onmouseup
Returns the event handling code for the mouseup event.
onresize
Returns the event handling code for the resize event.
{{ wiki.languages( { "en": "en/Gecko_DOM_Reference/element" } ) }}

Source de la révision

<p>
</p>
<h3 name="Introduction"> Introduction </h3>
<p>Ce chapitre fournit une brève référence pour toutes les méthodes, propriétés et évènements disponibles pour tous les élements HTML et XML dans le DOM des navigateurs utilisant Gecko.
</p><p>Ces interfaces DOM sont réparties sur les différents niveaux de spécification du DOM, mais font pour la plupart partie de la recommandation DOM Level 2. Chaque membre fournit un lien vers sa définition dans les spécifications DOM du W3C.
</p><p>Ici, le mot « Elements » se réfère à l'interface que tous les éléments HTML et XML ont en commun depuis le DOM. Il y a des interfaces plus spécialisées pour des objets particuliers, par exemple l'élément BODY qui dispose de fonctions et propriétés supplémentaires, ou encore les tableaux. Mais ce chapitre ne concerne que les interfaces partagées par tous les éléments.
</p>
<h3 name="Propri.C3.A9t.C3.A9s"> Propriétés </h3>
<dl><dt> <a href="fr/Attributes">attributes</a>
</dt><dd> Returns an array of the attributes on the element.
</dd></dl>
<dl><dt> <a href="fr/ChildNodes">childNodes</a>
</dt><dd> Returns an array of the child nodes on the element.
</dd></dl>
<dl><dt> <a href="fr/ClassName">className</a>
</dt><dd> Gets/sets the class of the element.
</dd></dl>
<dl><dt> <a href="fr/ClientHeight">clientHeight</a>
</dt><dd> DHTML property that represents the inner height of an element.
</dd></dl>
<dl><dt> <a href="fr/ClientWidth">clientWidth</a>
</dt><dd> DHTML property that represents the inner width of an element.
</dd></dl>
<dl><dt> <a href="fr/Dir">dir</a>
</dt><dd> Gets/sets the directionality of the element.
</dd></dl>
<dl><dt> <a href="fr/FirstChild">firstChild</a>
</dt><dd> Returns the first direct child of the current node.
</dd></dl>
<dl><dt> <a href="fr/Id">id</a>
</dt><dd> Gets/sets the id of the current element.
</dd></dl>
<dl><dt> <a href="fr/InnerHTML">innerHTML</a>
</dt><dd> innerHTML returns all of the markup and content within a given element.
</dd></dl>
<dl><dt> <a href="fr/Lang">lang</a>
</dt><dd> Specifies the base language of an element's attribute values and text content.
</dd></dl>
<dl><dt> <a href="fr/LastChild">lastChild</a>
</dt><dd> Returns the last child of the current node.
</dd></dl>
<dl><dt> <a href="fr/Length">length</a>
</dt><dd> Returns the number of items in a list (e.g. childNodes).
</dd></dl>
<dl><dt> <a href="fr/LocalName">localName</a>
</dt><dd> localName returns the local part of the qualified name of this node.
</dd></dl>
<dl><dt> <a href="fr/NamespaceURI">namespaceURI</a>
</dt><dd> The namespace URI of this node, or NULL if it is unspecified.
</dd></dl>
<dl><dt> <a href="fr/NextSibling">nextSibling</a>
</dt><dd> Returns the node immediately following the current one in the tree.
</dd></dl>
<dl><dt> <a href="fr/NodeName">nodeName</a>
</dt><dd> Returns the name of the current node.
</dd></dl>
<dl><dt> <a href="fr/NodeType">nodeType</a>
</dt><dd> Returns the type of the current node.
</dd></dl>
<dl><dt> <a href="fr/NodeValue">nodeValue</a>
</dt><dd> Returns the value of the current node.
</dd></dl>
<dl><dt> <a href="fr/OffsetHeight">offsetHeight</a>
</dt><dd> offsetHeight is a DHTML property that gets the height of an element relative to the layout.
</dd></dl>
<dl><dt> <a href="fr/OffsetLeft">offsetLeft</a>
</dt><dd> offsetLeft gets/sets the number of pixels that the current element is offset to the left within the offsetParent node.
</dd></dl>
<dl><dt> <a href="fr/OffsetParent">offsetParent</a>
</dt><dd> offsetParent returns a reference to the object in which the current element is offset (i.e., the parent element).
</dd></dl>
<dl><dt> <a href="fr/OffsetTop">offsetTop</a>
</dt><dd> offsetTop returns the position of the current element relative to the top of the offsetParent node.
</dd></dl>
<dl><dt> <a href="fr/OffsetWidth">offsetWidth</a>
</dt><dd> offsetWidth is a DHTML property that gets the width of an element relative to the layout.
</dd></dl>
<dl><dt> <a href="fr/OwnerDocument">ownerDocument</a>
</dt><dd> Returns the document in which this node appears.
</dd></dl>
<dl><dt> <a href="fr/ParentNode">parentNode</a>
</dt><dd> Returns the parent node of the current node.
</dd></dl>
<dl><dt> <a href="fr/Prefix">prefix</a>
</dt><dd> prefix returns the namespace prefix of the current node, or NULL if it is unspecified.
</dd></dl>
<dl><dt> <a href="fr/PreviousSibling">previousSibling</a>
</dt><dd> Returns the node immediately previous to the current one in the tree.
</dd></dl>
<dl><dt> <a href="fr/ScrollHeight">scrollHeight</a>
</dt><dd> DHTML property that gets the height of the scroll view of an element.
</dd></dl>
<dl><dt> <a href="fr/ScrollTop">scrollTop</a>
</dt><dd> DHTML property that sets or gets the distance between the top of an element and the topmost portion of its content currently visible.
</dd></dl>
<dl><dt> <a href="fr/Style">style</a>
</dt><dd> style returns the block of style rules on the current element.
</dd></dl>
<dl><dt> <a href="fr/TabIndex">tabIndex</a>
</dt><dd> Gets/sets the position of the element in the tabbing order.
</dd></dl>
<dl><dt> <a href="fr/TagName">tagName</a>
</dt><dd> tagName returns the name of the element.
</dd></dl>
<dl><dt> <a href="fr/Title">title</a>
</dt><dd> title returns the title of the document.
</dd></dl>
<h3 name="M.C3.A9thodes"> Méthodes </h3>
<dl><dt> <a href="fr/AddEventListener">addEventListener</a>
</dt><dd> addEventListener allows the registration of event listeners on the event target.
</dd></dl>
<dl><dt> <a href="fr/AppendChild">appendChild</a>
</dt><dd> The appendChild method inserts the specified node into the list of nodes on the current document.
</dd></dl>
<dl><dt> <a href="fr/Blur">blur</a>
</dt><dd> The blur method removes keyboard focus from the current element.
</dd></dl>
<dl><dt> <a href="fr/Click">click</a>
</dt><dd> The click method excecutes a click on the current element.
</dd></dl>
<dl><dt> <a href="fr/CloneNode">cloneNode</a>
</dt><dd> The cloneNode method returns a duplicate of the current node.
</dd></dl>
<dl><dt> <a href="fr/CreateAttribute">createAttribute</a>
</dt><dd> The createAttribute method creates a new attribute on the current element.
</dd></dl>
<dl><dt> <a href="fr/DispatchEvent">dispatchEvent</a>
</dt><dd> The dispatchEvent method allows the dispatch of events into the implementation's event model.
</dd></dl>
<dl><dt> <a href="fr/Focus">focus</a>
</dt><dd> focus sets focus on the current element.
</dd></dl>
<dl><dt> <a href="fr/GetAttribute">getAttribute</a>
</dt><dd> getAttribute returns the value of the named attribute on the current node.
</dd></dl>
<dl><dt> <a href="fr/GetAttributeNS">getAttributeNS</a>
</dt><dd> getAttributeNS returns the value of the attribute with the given name and namespace.
</dd></dl>
<dl><dt> <a href="fr/GetAttributeNode">getAttributeNode</a>
</dt><dd> Returns the attribute of the current element as a separate node.
</dd></dl>
<dl><dt> <a href="fr/GetElementsByTagName">getElementsByTagName</a>
</dt><dd> Renvoie les éléments portant un nom particulier et faisant partie des enfants de l'élément courant.
</dd></dl>
<dl><dt> <a href="fr/HasAttribute">hasAttribute</a>
</dt><dd> hasAttribute returns a boolean value indicating whether the current element has the specified attribute or not.
</dd></dl>
<dl><dt> <a href="fr/HasAttributeNS">hasAttributeNS</a>
</dt><dd> hasAttribute is a boolean value indicating whether the current element has an attribute with the specified name and namespace.
</dd></dl>
<dl><dt> <a href="fr/HasAttributes">hasAttributes</a>
</dt><dd> hasAttribute is a boolean value indicating whether the current element has any attributes.
</dd></dl>
<dl><dt> <a href="fr/HasChildNodes">hasChildNodes</a>
</dt><dd> hasChildNodes is a boolean value indicating whether the current element has children or not.
</dd></dl>
<dl><dt> <a href="fr/InsertBefore">insertBefore</a>
</dt><dd> The insertBefore method allows you to insert a node before the current element in the DOM.
</dd></dl>
<dl><dt> <a href="fr/Item">item</a>
</dt><dd> The item method retrieves a node from the tree by index.
</dd></dl>
<dl><dt> <a href="fr/Normalize">normalize</a>
</dt><dd> The normalize method puts the current node and all of its subtree into a "normalized" form (see below).
</dd></dl>
<dl><dt> <a href="fr/RemoveAttribute">removeAttribute</a>
</dt><dd> The removeAttribute() method removes an attribute from the current element.
</dd></dl>
<dl><dt> <a href="fr/RemoveAttributeNode">removeAttributeNode</a>
</dt><dd> removeAttributeNode removes the specified attribute from the current element.
</dd></dl>
<dl><dt> <a href="fr/RemoveChild">removeChild</a>
</dt><dd> The removeChild() method removes a child node from the current element.
</dd></dl>
<dl><dt> <a href="fr/RemoveEventListener">removeEventListener</a>
</dt><dd> removeEventListener() allows the removal of event listeners from the event target.
</dd></dl>
<dl><dt> <a href="fr/ReplaceChild">replaceChild</a>
</dt><dd> The replaceChild() method replaces one child node on the current element with another.
</dd></dl>
<dl><dt> <a href="fr/SetAttribute">setAttribute</a>
</dt><dd> setAttribute adds a new attribute or changes the value of an existing attribute on the current element.
</dd></dl>
<dl><dt> <a href="fr/SetAttributeNS">setAttributeNS</a>
</dt><dd> setAttributeNS adds a new attribute or changes the value of an attribute with the given namespace and name.
</dd></dl>
<dl><dt> <a href="fr/SetAttributeNode">setAttributeNode</a>
</dt><dd> setAttributeNode adds a new attribute node to the current element.
</dd></dl>
<dl><dt> <a href="fr/SetAttributeNodeNS">setAttributeNodeNS</a>
</dt><dd> setAttributeNodeNS adds a new attribute node with the specified namespace and name.
</dd></dl>
<dl><dt> <a href="fr/Supports">supports</a>
</dt><dd> The supports method tests if this DOM implementation supports a particular feature.
</dd></dl>
<h3 name=".C3.89v.C3.A8nements"> Évènements </h3>
<p>Ces propriétés des éléments ne peuvent pas être assignées de la même manière que les gestionnaires d'évènements sur les objets document et window. Toutes les propriétés des évènements suivants sont en lecture seule, et sont faites pour renvoyer le code de gestion d'évènement, si applicable, qui a déjà été ajouté à l'élément au sein du code HTML ou XML lui-même.
</p>
<dl><dt> <a href="fr/Onblur">onblur</a>
</dt><dd> Returns the event handling code for the blur event.
</dd></dl>
<dl><dt> <a href="fr/Onclick">onclick</a>
</dt><dd> Returns the event handling code for the click event.
</dd></dl>
<dl><dt> <a href="fr/Ondblclick">ondblclick</a>
</dt><dd> Returns the event handling code for the dblclick event.
</dd></dl>
<dl><dt> <a href="fr/Onfocus">onfocus</a>
</dt><dd> Returns the event handling code for the focus event.
</dd></dl>
<dl><dt> <a href="fr/Onkeydown">onkeydown</a>
</dt><dd> Returns the event handling code for the keydown event.
</dd></dl>
<dl><dt> <a href="fr/Onkeypress">onkeypress</a>
</dt><dd> Returns the event handling code for the keypress event.
</dd></dl>
<dl><dt> <a href="fr/Onkeyup">onkeyup</a>
</dt><dd> Returns the event handling code for the keyup event.
</dd></dl>
<dl><dt> <a href="fr/Onmousedown">onmousedown</a>
</dt><dd> Returns the event handling code for the mousedown event.
</dd></dl>
<dl><dt> <a href="fr/Onmousemove">onmousemove</a>
</dt><dd> Returns the event handling code for the mousemove event.
</dd></dl>
<dl><dt> <a href="fr/Onmouseout">onmouseout</a>
</dt><dd> Returns the event handling code for the mouseout event.
</dd></dl>
<dl><dt> <a href="fr/Onmouseover">onmouseover</a>
</dt><dd> Returns the event handling code for the mouseover event.
</dd></dl>
<dl><dt> <a href="fr/Onmouseup">onmouseup</a>
</dt><dd> Returns the event handling code for the mouseup event.
</dd></dl>
<dl><dt> <a href="fr/Onresize">onresize</a>
</dt><dd> Returns the event handling code for the resize event.
</dd></dl>
{{ wiki.languages( { "en": "en/Gecko_DOM_Reference/element" } ) }}
Revenir à cette révision