/* * vérification et aide à la saisie des champs */ function surligne( champ, erreur ) { if(erreur) //champ.style.backgroundColor = "#fba"; champ.style.border = "3px solid #a00"; else //champ.style.backgroundColor = ""; champ.style.border = "3px solid #0a0"; } function verifChamp( champ, regex, champComment, exemple ) { if ( champ.value.length < 1 ) { surligne(champ, true); champComment.textContent = "Veuillez remplir ce champ"; champComment.style.color = "#a00"; return false; } else if(!regex.test(champ.value)) { surligne(champ, true); champComment.textContent = "Saisie incorrecte, exemple : " + exemple; champComment.style.color = "#a00"; return false; } else { surligne(champ, false); champComment.textContent = ""; return true; } } function verifConfirmPwd( champ, champConfirm, champComment ) { if ( champConfirm.value != champ.value ) { surligne(champ, true); champComment.textContent = "La confirmation ne correspond pas au mot de passe"; champComment.style.color = "#a00"; return false; } else { surligne(champ, false); champComment.textContent = ""; return true; } }