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 33 34 35 36 37 38 39 40 41
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test</title>
<style type="text/css" media="screen">
#noJS_captchaContainer{display:block}
</style>
</head>
<body>
<form action="http://accessible.exemple.com/soumission.php" method="post" id="form">
<div>
<label for="user">Utilisateur :</label><br /><input type="text" name="user" id="user" value="" /><br />
<label for="pass">Mot de passe :</label><br /><input type="password" name="pass" id="pass" value="" /><br /><br />
<div id="noJS_captchaContainer">
<label for="captcha">Code :</label> <img src="captcha.php" alt="" /><br />
<input type="text" name="captcha" id="captcha" value="" /><br /><br />
</div>
<input type="submit" value="Envoyer" name="send" id="send" />
</div>
</form>
<script type="text/javascript">
var elt=document.getElementById('noJS_captchaContainer');
/* Si Javascript est activé, on peut cacher l'élément HTML (id="noJS_captchaContainer") avec le code
elt.style.display='none';
Mais il est préférable - pour éviter les conflits de noms (name et/ou id) - de... */
// Supprimer complétement l'élément HTML (id="noJS_captchaContainer")
while(elt.hasChildNodes())elt.removeChild(elt.lastChild);
elt.parentNode.removeChild(elt);
// À partir d'ici ou une fois le document chargé (onload), on peut ajouter le Captcha JS dans l'arbre DOM.
</script>
</body>
</html> |
Partager