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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
   | <script type="text/javascript">
 
function changeBackgroundColor(elemnt,couleur)
{
   if (elemnt) { elemnt.style.backgroundColor = couleur; }
   return;
}
 
function verify()
{
   tt = document.forms['clientform'];
   if (tt.Code.value=="")
   {
      alert("Saisir Votre Code SVP!");
      tt.Code.focus();
      changeBackgroundColor(document.clientform.Code);
      return false;
   } else {
      document.clientform.action="Enseignant.php?mode=control";
      document.clientform.submit();
      return true;
   }
}
 
function checkmail(email) {
   var reg = /^[a-z0-9._-]+@[a-z0-9.-]{2,}[.][a-z]{2,5}$/
   if(reg.exec(email)==null) { return false; }
   else { return true; }
}
function ajout()
{
   chp = document.forms['clientform2'];
   changeBackgroundColor(document.clientform2.CodE,'white');
   changeBackgroundColor(document.clientform2.NomE,'white');
   changeBackgroundColor(document.clientform2.PrenE,'white');
   changeBackgroundColor(document.clientform2.AdrE,'white');
   changeBackgroundColor(document.clientform2.ViE,'white');
   changeBackgroundColor(document.clientform2.TelE,'white');
   changeBackgroundColor(document.clientform2.emailE,'white');
 
   if (chp.CodE.value=="" || chp.NomE.value=="" || chp.PrenE.value=="" || chp.AdrE.value=="" || chp.ViE.value=="" || chp.TelE.value==""  || chp.emailE.value=="")
   {
      alert("Remplir tous les champs SVP!");
      if (chp.CodE.value=="") { chp.CodE.focus(); changeBackgroundColor(document.clientform2.CodE,'yellow'); }
      else if (chp.NomE.value=="") { chp.NomE.focus(); changeBackgroundColor(document.clientform2.NomE,'yellow'); }
      else if (chp.PrenE.value=="") { chp.PrenE.focus(); changeBackgroundColor(document.clientform2.PrenE,'yellow'); }
      else if (chp.AdrE.value=="") { chp.AdrE.focus(); changeBackgroundColor(document.clientform2.AdrE,'yellow'); }
      else if (chp.ViE.value=="") { chp.ViE.focus(); changeBackgroundColor(document.clientform2.ViE,'yellow'); }
      else if (chp.TelE.value=="") { chp.TelE.focus(); changeBackgroundColor(document.clientform2.TelE,'yellow'); }
      else if (chp.emailE.value=="") { chp.emailE.focus(); changeBackgroundColor(document.clientform2.emailE,'yellow'); }
      return false;
   } else {
      if (isNaN(chp.TelE.value))
      {
         alert("Numero Invalide!");
         changeBackgroundColor(document.clientform2.TelE,'yellow');
         chp.TelE.focus();
         return false;
      }
      else if (!checkmail(chp.emailE.value))
      {
         alert("E-mail Invalide!");
         changeBackgroundColor(document.clientform2.emailE,'yellow');
         chp.emailE.focus();
         return false;
      }
      else
      {
         document.clientform2.action="Enseignant.php?mode=add";
         document.clientform2.submit();
         return true;
      }
   }
}
</script> | 
Partager