<!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=iso-8859-1">
<title>Document sans titre</title>
</head>


<body>
function1 init() {
	// on recupere chaque champ a verifier

	var password = document.getElementById('password');

	
	// initialise l'appel aux fonctions pour chaque champ
	// il y a des différences de traitement DOM entre IE et Firefox, notamment pour l'affectation d'évenement
	// pour IE
	if (window.attachEvent) {
	
		password.onkeyup = function1() { verifPassword(password); };

	}
	// pour Firefox
	else {
		
		password.setAttribute('onKeyUp', 'verifPassword(password)');

	}
}
 

 
function1 verifPassword(password) {
	motDePasse = password.value;
	password_alert = document.getElementById('password_alert');
	password_alert1 = document.getElementById('password_alert1');
	// suppression du texte existant
	while(password_alert.firstChild != null) {
		password_alert.removeChild(password_alert.firstChild);
	}
	while(password_alert1.firstChild != null) {
		password_alert1.removeChild(password_alert1.firstChild);
	}
	// creation du message suivant le cas
	if(motDePasse.length < 6) {
		var texte = document.createTextNode("Niveau faible");
	}
	if(motDePasse.length >= 6 && motDePasse.length < 8) {
		var texte = document.createTextNode("Niveau correct");
	}
	if(motDePasse.length >= 8) {
		var texte = document.createTextNode("Niveau élevé");
	}
	password_alert.appendChild(texte);
		password_alert1.appendChild(texte);
}
 

 

 
</body>
</html>
