Voila j'ai un code qui fais bien sont travail sauf qu'il n'est pas valid xhtml.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 <script> function verif() { if (document.forms['form_contact'].nom.value == "") { alert("Vous devez saisir votre nom") return false } if (document.forms['form_contact'].prenom.value == "") { alert("Vous devez saisir votre prenom") return false } if (document.forms['form_contact'].email.value == "") { alert("Vous devez saisir votre email") return false } if (document.forms['form_contact'].sujet.value == "") { alert("Vous devez saisir votre sujet") return false } if (document.forms['form_contact'].message.value == "") { alert("Vous devez saisir votre message") return false } return verifMail(form_contact.email.value); } function verifMail(a) { testm = false ; for (var j=1 ; j<(a.length) ; j++) { if (a.charAt(j)=='@') { if (j<(a.length-4)){ for (var k=j ; k<(a.length-2) ; k++) { if (a.charAt(k)=='.') testm = true; } } } } if (testm==false){ // ligne suivante non obligatoire alert('Votre adresse e-mail est incorrecte.'); } return testm ; } </script>
Partager