-
This example uses the HTML DOM to assign an "onmouseover" and "onmouseout" event to a h1 element.
Mouse over me
-
<p
Click on the image, and the input will be sent to a page on the server called "/action_page.php".
Note: The image input type sends the X and Y coordinates of the click that activated the image button as default.
>
-
-
Placez votre curseur sur la couleur de votre choix pour la mettre en fond.
-
Résultat de l'exemple
Utilisation de l'attribut id en Javascript
JavaScript peut accéder à un élément avec la méthode getElementById() :
Bonjour tout le monde
Exemple
<!DOCTYPE html>
<html>
<body><h2>Utilisation de l'attribut id en Javascript</h2>
<p>JavaScript peut accéder à un élément avec la méthode getElementById() :</p><h1 id="myHeader">Bonjour tout le monde</h1>
<button onclick="displayResult()">Change text</button><script>
function displayResult() {
document.getElementById("myHeader").innerHTML = "Bonne journée!";
}
</script></body>
</html>
Suivre le flux RSS des articles
Suivre le flux RSS des commentaires