Exécuter
❯
Exécuter le code
Ctrl+Alt+R
Sauvegarder le code
Ctrl+Alt+A
Changer d'orientation
Ctrl+Alt+O
Changer de thème
Ctrl+Alt+D
<!DOCTYPE html> <html> <head> <script> function lighton() { document.getElementById('myimage').src = "bulbon.gif"; } function lightoff() { document.getElementById('myimage').src = "bulboff.gif"; } </script> </head> <body> <h1>Événements HTML JavaScript</h1> <h2>L'attribut onmousedown</h2> <img id="myimage" onmousedown="lighton()" onmouseup="lightoff()" src="bulboff.gif" width="100" height="180" /> <p>Cliquez sur la souris et maintenez enfoncé !</p> </body> </html>