| 12
 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
 
 | function init() {
	var username = document.getElementById('username');
	var password = document.getElementById('password');
	var email = document.getElementById('email');
 
	if (window.attachEvent) {
		username.onkeyup = function() { verifUsername(username); };
		password.onkeyup = function() { verifPassword(password); };
		email.onkeyup = function() { verifEmail(email); };
	}else{
		username.setAttribute('onKeyUp', 'verifUsername(username)');
		password.setAttribute('onKeyUp', 'verifPassword(password)');
		email.setAttribute('onKeyUp', 'verifEmail(email)');
	}
}
 
function verifUsername(username) {
	pSeuDo = username.value;
	username_alert = document.getElementById('username_alert');
 
	while(username_alert.firstChild != null) {
		username_alert.removeChild(username_alert.firstChild);
	}
 
	if(pSeuDo.length < 3) {
		var texte = document.createTextNode("Le nom d'utilisateur est trop court");
		username_alert.appendChild(texte);
	} else {	
	var XHR = new XHRConnection();
	XHR.appendData("username", username.value);
	XHR.sendAndLoad("verifUsername.php", "POST", afficheDispo);
	}
} | 
Partager