// version : 16/06/2008 //====================== // Fonction d'envoi //------------------ function validation(){ var x=1; // nom - Nom //------------ if (document.frm.nom.value.length>100 && x==1){ x=0; document.frm.nom.focus(); alert("Votre nom est trop long (100 caractéres au maximum)"); return false; } if (document.frm.nom.value=="" && x==1){ x=0; document.frm.nom.focus(); alert("Vous avez oublié d'indiquer votre nom"); return false; } // pre - prénom //-------------- if (document.frm.pre.value.length>100 && x==1){ x=0; document.frm.pre.focus(); alert("Votre prénom est trop long (100 caractéres au maximum)"); return false; } if (document.frm.pre.value=="" && x==1){ x=0; document.frm.pre.focus(); alert("Vous avez oublié d'indiquer votre prénom"); return false; } // adr - adresse //--------------- if (document.frm.adr.value.length>200 && x==1){ x=0; document.frm.adr.focus(); alert("Votre adresse est trop longue (200 caractéres au maximum)"); return false; } if (document.frm.adr.value=="" && x==1){ x=0; document.frm.adr.focus(); alert("Vous avez oublié d'indiquer votre adresse"); return false; } // cpo - code postal //------------------- if (document.frm.cpo.value.length>20 && x==1){ x=0; document.frm.cpo.focus(); alert("Votre code postal est trop long (20 caractéres au maximum)"); return false; } if (document.frm.cpo.value=="" && x==1){ x=0; document.frm.cpo.focus(); alert("Vous avez oublié d'indiquer votre code postal"); return false; } // vil - ville ou commune //------------------------ if (document.frm.vil.value.length>100 && x==1){ x=0; document.frm.vil.focus(); alert("Le nom de votre ville ou commune est trop long (100 caractéres au maximum)"); return false; } if (document.frm.vil.value=="" && x==1){ x=0; document.frm.vil.focus(); alert("Vous avez oublié d'indiquer le nom de votre ville ou commune"); return false; } // pay - pays //------------ if (document.frm.pay.value.length>100 && x==1){ x=0; document.frm.pay.focus(); alert("Le nom de votre pays est trop long (100 caractéres au maximum)"); return false; } if (document.frm.pay.value=="" && x==1){ x=0; document.frm.pay.focus(); alert("Vous avez oublié d'indiquer le nom de votre pays"); return false; } // aem - Adresse email //--------------------- if(document.frm.aem.value.length>50 && x==1){ x=0; document.frm.aem.focus(); alert("L'adresse e-mail est trop longue (50 caractéres au maximum)"); return false; } if(document.frm.aem.value!=""){ document.frm.aem.value = document.frm.aem.value.toLowerCase(); var z = "-_.@0123456789abcdefghijklmnopqrstuvwxyz"; var y = ""; for (i=0;i "+y); return false; } } var erreurma = 0; var positio1 = document.frm.aem.value.indexOf("@"); var positio2 = document.frm.aem.value.indexOf(".",positio1); if(positio1>0 && positio2>(positio1+1) && positio20){ x=0; document.frm.aem.focus(); alert("Vous avez fait une erreur dans l'écriture de votre adresse e-mail. Veuillez la vérifier S.V.P."); return false; } } // tel - téléphone //----------------- if (document.frm.tel.value.length>20 && x==1){ x=0; document.frm.tel.focus(); alert("Le numéro de téléphone est trop long (20 caractéres au maximum)"); return false; } // mes - message //--------------- if (document.frm.mes.value.length>10000 && x==1){ x=0; document.frm.mes.focus(); alert("Le message est trop long (10000 caractéres au maximum)"); return false; } // Formulaire OK //--------------- if(x==1){ document.frm.ok.value = "Patientez S.V.P..."; document.frm.ok.disabled = true; document.frm.submit(); } }