SELFHTML/Quickbar  HTML  Attributs universels


Gestionnaire d'évènements

Cette page est un document avec du texte et des informations

 Généralités sur les gestionnaires d'évènements
 Liste des gestionnaires d'évènements

 

HTML4.0 Généralités sur les gestionnaires d'évènements

Beispiel Exemple d'affichage: comment on fait

Event-Handler (gestionnaire d'évènements) sont des attributs HTML qui fabriquent une liaison à un langage Script. Un évènement est par exemple est par exemple un cliquement de souris ou une touche appuyée par l'utilisateur. Un élément qui contient un gestionnaire d'évènements peut réagir à un tel évènement si l'évènement se passe dans le domaine d'affichage de l'élément. Avec le gestionnaire d'évènements vous pouvez par exemple appeler une fonction  JavaScript qui traite l'évènement et réagit.

Exemple:

<p onClick="alert('vous avez cliqué dans le paragraphe!')">un paragraphe</p>

Explication:

L'exemple contient un paragraphe de texte <p> ... </p>. Dans le repère d'ouverture <p> est noté le gestionnaire d'évènements onClick=. Vous pouvez reconnaître les gestionnaires d'évènements en règle générale à ce qu'ils commencent par on.... Le gestionnaire d'évènements onClick= signifie en gros, "lors du cliquement". Il se rapporte au domaine d'affichage du paragraphe.

Dans l'exemple une sortie écran dira, au moyen d'une boite de dialogue: "Vous avez cliqué dans le paragraphe!". C'est la syntaxe JavaScript. Les éléments du langage JavaScript ne seront pas traités davantage ici. Lisez pour cela la documentation JavaScript.

Attention:

Netscape jusqu'à la version 4.x comprise interprète bien des gestionnaires d'évènements mais seulement dans certains repères HTML. Il est certain que beaucoup de gestionnaires d'évènements n'ont un sens que dans certains repères HTML. Pourtant dans l'ensemble, la gestion d'évènements dans des éléments HTML d'après le standard HTML 4.0, est sensiblement plus large que ce n'est le cas dans les versions JavaScript 1.0, 1.1 et 1.2 de Netscape. Ainsi même l'exemple ci-dessus ne fonctionne pas chez Netscape.

L' Explorer Internet MS interprète des gestionnaires d'évènements étendus depuis la version 4.x du produit. Il n'est pas possible de vérifier si toutes les possibilités imaginables du standard HTML 4.0 sont réalisables. L'exemple ci-dessus (et aussi l'exemple d'affichage) fonctionnent en tous cas avec l' Explorer Internet 4.x.

 

HTML4.0 Liste des gestionnaires d'évènements

La liste suivante contient les gestionnaires d'évènements cités dans la spécification HTML 4.0 du consortium W3. Vous aurez plus de détails sur les gestionnaires d'évènements dans la documentation javascript dans la partie sur les  gestionnaires d'évènements comme partie des  éléments de langage JavaScript.

gestionnaire d'évènements Signification exemple permis dans les repères HTML suivants
onblur= "en quittant l'élément" voir
 onBlur
en JavaScript
<a> <area> <button> <input> <label> <select> <textarea>
onchange= "quand la valeur d'un élément est modifiée" voir
 onChange
en JavaScript
<input> <select> <textarea>
onclick= "en cliquant avec la souris" voir
 onClick
en JavaScript
<a> <abbr> <acronym> <address> <area> <b> <big> <blockquote> <body> <button> <caption> <center> <cite> <code> <col> <colgroup> <dd> <del> <dfn> <dir> <div> <dl> <dt> <em> <fieldset> <form> <h1> <h2> <h3> <h4> <h5> <h6> <hr> <i> <img> <input> <ins> <kbd> <label> <legend> <li> <link> <map> <menu> <noframes> <noscript> <object> <ol> <optgroup> <option> <p> <pre> <q> <s> <samp> <select> <small> <span> <strike> <strong> <sub> <sup> <table> <tbody> <td> <textarea> <tfoot> <th> <thead> <tr> <tt> <u> <ul> <var>
ondblclick= "en double-cliquant avec la souris dans le domaine de l'élément" voir
 onDblClick
en JavaScript
<a> <abbr> <acronym> <address> <area> <b> <big> <blockquote> <body> <button> <caption> <center> <cite> <code> <col> <colgroup> <dd> <del> <dfn> <dir> <div> <dl> <dt> <em> <fieldset> <form> <h1> <h2> <h3> <h4> <h5> <h6> <hr> <i> <img> <input> <ins> <kbd> <label> <legend> <li> <link> <map> <menu> <noframes> <noscript> <object> <ol> <optgroup> <option> <p> <pre> <q> <s> <samp> <select> <small> <span> <strike> <strong> <sub> <sup> <table> <tbody> <td> <textarea> <tfoot> <th> <thead> <tr> <tt> <u> <ul> <var>
onfocus= "en se positionnant sur l'élément" voir
 onFocus
en JavaScript
<a> <area> <button> <input> <label> <select> <textarea>
onkeydown= "quand une touche est appuyée" (mais pas encore relâchée) voir
 onKeyDown
en JavaScript
<a> <abbr> <acronym> <address> <area> <b> <big> <blockquote> <body> <button> <caption> <center> <cite> <code> <col> <colgroup> <dd> <del> <dfn> <dir> <div> <dl> <dt> <em> <fieldset> <form> <h1> <h2> <h3> <h4> <h5> <h6> <hr> <i> <img> <input> <ins> <kbd> <label> <legend> <li> <link> <map> <menu> <noframes> <noscript> <object> <ol> <optgroup> <option> <p> <pre> <q> <s> <samp> <select> <small> <span> <strike> <strong> <sub> <sup> <table> <tbody> <td> <textarea> <tfoot> <th> <thead> <tr> <tt> <u> <ul> <var>
onkeypress= "quand une touche est appuyée" (et relâchée) voir
 onKeyPress
en JavaScript
<a> <abbr> <acronym> <address> <area> <b> <big> <blockquote> <body> <button> <caption> <center> <cite> <code> <col> <colgroup> <dd> <del> <dfn> <dir> <div> <dl> <dt> <em> <fieldset> <form> <h1> <h2> <h3> <h4> <h5> <h6> <hr> <i> <img> <input> <ins> <kbd> <label> <legend> <li> <link> <map> <menu> <noframes> <noscript> <object> <ol> <optgroup> <option> <p> <pre> <q> <s> <samp> <select> <small> <span> <strike> <strong> <sub> <sup> <table> <tbody> <td> <textarea> <tfoot> <th> <thead> <tr> <tt> <u> <ul> <var>
onkeyup= "quand une ouche est relâchée" voir
 onKeyUp
en JavaScript
<a> <abbr> <acronym> <address> <area> <b> <big> <blockquote> <body> <button> <caption> <center> <cite> <code> <col> <colgroup> <dd> <del> <dfn> <dir> <div> <dl> <dt> <em> <fieldset> <form> <h1> <h2> <h3> <h4> <h5> <h6> <hr> <i> <img> <input> <ins> <kbd> <label> <legend> <li> <link> <map> <menu> <noframes> <noscript> <object> <ol> <optgroup> <option> <p> <pre> <q> <s> <samp> <select> <small> <span> <strike> <strong> <sub> <sup> <table> <tbody> <td> <textarea> <tfoot> <th> <thead> <tr> <tt> <u> <ul> <var>
onload= "en chargeant" voir
 onLoad
en JavaScript
<frameset> <body>
onmousedown= "en appuyant une touche de la souris" voir
 onMousedown
en JavaScript
<a> <abbr> <acronym> <address> <area> <b> <big> <blockquote> <body> <button> <caption> <center> <cite> <code> <col> <colgroup> <dd> <del> <dfn> <dir> <div> <dl> <dt> <em> <fieldset> <form> <h1> <h2> <h3> <h4> <h5> <h6> <hr> <i> <img> <input> <ins> <kbd> <label> <legend> <li> <link> <map> <menu> <noframes> <noscript> <object> <ol> <optgroup> <option> <p> <pre> <q> <s> <samp> <select> <small> <span> <strike> <strong> <sub> <sup> <table> <tbody> <td> <textarea> <tfoot> <th> <thead> <tr> <tt> <u> <ul> <var>
onmousemove= "en bougeant la souris" voir
 onMousemove
en JavaScript
<a> <abbr> <acronym> <address> <area> <b> <big> <blockquote> <body> <button> <caption> <center> <cite> <code> <col> <colgroup> <dd> <del> <dfn> <dir> <div> <dl> <dt> <em> <fieldset> <form> <h1> <h2> <h3> <h4> <h5> <h6> <hr> <i> <img> <input> <ins> <kbd> <label> <legend> <li> <link> <map> <menu> <noframes> <noscript> <object> <ol> <optgroup> <option> <p> <pre> <q> <s> <samp> <select> <small> <span> <strike> <strong> <sub> <sup> <table> <tbody> <td> <textarea> <tfoot> <th> <thead> <tr> <tt> <u> <ul> <var>
onmouseout= "quand la souris quitte le domaine de l'élément" voir
 onMouseout
en JavaScript
<a> <abbr> <acronym> <address> <area> <b> <big> <blockquote> <body> <button> <caption> <center> <cite> <code> <col> <colgroup> <dd> <del> <dfn> <dir> <div> <dl> <dt> <em> <fieldset> <form> <h1> <h2> <h3> <h4> <h5> <h6> <hr> <i> <img> <input> <ins> <kbd> <label> <legend> <li> <link> <map> <menu> <noframes> <noscript> <object> <ol> <optgroup> <option> <p> <pre> <q> <s> <samp> <select> <small> <span> <strike> <strong> <sub> <sup> <table> <tbody> <td> <textarea> <tfoot> <th> <thead> <tr> <tt> <u> <ul> <var>
onmouseover= "quand la souris atteint le domaine de l'élément" voir
 onMouseover
en JavaScript
<a> <abbr> <acronym> <address> <area> <b> <big> <blockquote> <body> <button> <caption> <center> <cite> <code> <col> <colgroup> <dd> <del> <dfn> <dir> <div> <dl> <dt> <em> <fieldset> <form> <h1> <h2> <h3> <h4> <h5> <h6> <hr> <i> <img> <input> <ins> <kbd> <label> <legend> <li> <link> <map> <menu> <noframes> <noscript> <object> <ol> <optgroup> <option> <p> <pre> <q> <s> <samp> <select> <small> <span> <strike> <strong> <sub> <sup> <table> <tbody> <td> <textarea> <tfoot> <th> <thead> <tr> <tt> <u> <ul> <var>
onmouseup= "en relâchant la touche de souris appuyée" voir
 onMouseup
en JavaScript
<a> <abbr> <acronym> <address> <area> <b> <big> <blockquote> <body> <button> <caption> <center> <cite> <code> <col> <colgroup> <dd> <del> <dfn> <dir> <div> <dl> <dt> <em> <fieldset> <form> <h1> <h2> <h3> <h4> <h5> <h6> <hr> <i> <img> <input> <ins> <kbd> <label> <legend> <li> <link> <map> <menu> <noframes> <noscript> <object> <ol> <optgroup> <option> <p> <pre> <q> <s> <samp> <select> <small> <span> <strike> <strong> <sub> <sup> <table> <tbody> <td> <textarea> <tfoot> <th> <thead> <tr> <tt> <u> <ul> <var>
onreset= "en annulant" voir
 onReset
en JavaScript
<form>
onselect= "en sélectionnant du texte" voir
 onSelect
en JavaScript
<input> <textarea>
onsubmit= "en envoyant" voir
 onSubmit
en JavaScript
<form>
onunload= "en terminant" voir
 onUnload
en JavaScript
<body> <frameset>

 
après: Feuilles de style et HTML
avant: Différents attributs universels
 

SELFHTML/Quickbar  HTML  Attributs universels

© 1998 Stefan Münz / © 2001 Traduction  Serge François, 13405@free.fr