Bonjour,
Le code suivant ne fonctionne pas :
mais le code suivant, fonctionne :
Cordialement,
o-o
Le code suivant ne fonctionne pas :
<!DOCTYPE html>
<html>
<head>
<title>onclick</title>
</head>
<body>
<h1 id="titre">Titre 1</h1>
<script>
document.getElementById('titre').onclick = function()
{
alert('test');
}
</script>
</body>
</html>
mais le code suivant, fonctionne :
<!DOCTYPE html>
<html>
<head>
<title>onclick</title>
</head>
<body>
<h1 id="titre">Titre 1</h1>
<script>
document.getElementById('titre').onclick = function()
{
document.getElementById('titre').innerHTML = 'Titre 2';
}
</script>
</body>
</html>
Cordialement,
o-o