sio2:le_document_object_model

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
sio2:le_document_object_model [2024/10/18 07:47] dthevenotsio2:le_document_object_model [2024/10/18 08:52] (Version actuelle) – [Propriétés des éléments] dthevenot
Ligne 80: Ligne 80:
 =====  ===== =====  =====
 ==== Propriétés des éléments ==== ==== Propriétés des éléments ====
-  
 Les éléments obtenus par sélection possèdent des propriétés manipulables : attributs, contenu, style  css.  Les éléments obtenus par sélection possèdent des propriétés manipulables : attributs, contenu, style  css. 
 === Manipuler les attributs === === Manipuler les attributs ===
Ligne 97: Ligne 96:
 var monImage = document.getElementById("photo");  var monImage = document.getElementById("photo"); 
 photo.src ="images/joconde.jpg";  photo.src ="images/joconde.jpg"; 
-photo.alt = La Joconde"; +photo.alt = "La Joconde"; 
 </code> </code>
 =====  ===== =====  =====
Ligne 118: Ligne 117:
 __Exemple :__ __Exemple :__
 <code>   <code>  
-var element = document . getElementById (" exemple "); var computed = window . getComputedStyle (element ); +var element = document . getElementById (" exemple ");  
 +var computed = window . getComputedStyle (element ); 
 var margeL = computed . marginLeft ; // unité récupérée en px, pas de  raccourci : computed.marge interdit  var margeL = computed . marginLeft ; // unité récupérée en px, pas de  raccourci : computed.marge interdit 
 var couleur = computed . backgroundColor ; // format rgb (... ,...  ,...)  var couleur = computed . backgroundColor ; // format rgb (... ,...  ,...) 
Ligne 142: Ligne 142:
   * parentNode ; nœud parent    * parentNode ; nœud parent 
   * childNodes : liste des nœuds enfants    * childNodes : liste des nœuds enfants 
-  * firstChild, lastChild : premier ou dernier nœud +=====  ===== 
 +  * firstChild, lastChild : premier ou dernier nœud
   * previousSibling, nextSibling : nœud frère precedent ou suivant    * previousSibling, nextSibling : nœud frère precedent ou suivant 
   * … cf https://developer.mozilla.org/fr/docs/Web/API/Node    * … cf https://developer.mozilla.org/fr/docs/Web/API/Node 
  • sio2/le_document_object_model.1729230440.txt.gz
  • Dernière modification : 2024/10/18 07:47
  • de dthevenot