Cacher un div, mon code ne fonctionne pas.
Bonjour à vous.
Je recherche depuis des heures la coquille qui empêche ce code de fonctionner. Je souhaite cacher/montrer le texte 'Bonjour à vous, ceci est un test'
Merci à vous pour votre aide.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| <!DOCTYPE html>
<html>
<head>
<title>Hello!</title>
</head>
<body>
<p><button id="1" onclick='AfficherCredits_35()'>Crédits audio</button></p>
<div id='Credits35' style='display:block;'>
<p>Bonjour à vous, ceci est un test !</p>
</div>
<script>
function AfficherCredits_35()
{
var div = document.getElementById('Credits35');
if (div.style.display != 'block')
{
div.style.display = 'none';
}
else
{
div.style.display = 'block';
}
}
</script>
</body>
</html> |