Bonjour,
j'ai r�aliser un simple formulaire de saisie pour une fonction mail, et mon contr�le en javascript ne fonctionne pas, mais je ne comprend pas pourquoi.
J'utilise wamp et je n'ai rien installer de particulier ( je ne sais pas si je devais)

j'ai realis� deux page diff�rente en esperant que cela fonctionne mais aucune des deux ne fonctionnent.
Je vous colle mes deux pages ici

1er essaye :
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
 
 
 
?>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Contact</title>
<link rel="stylesheet" href="css/main.css" />
<script type="text/javascript">
<!--
function MM_validateForm() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
      if (val) { nm=val.name; if ((val=val.value)!="") {
        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
          if (p<1 || p==(val.length-1)) errors+='- '+nm+' saisisser un mail valid.\n';
        } else if (test!='R') { num = parseFloat(val);
          if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
            min=test.substring(8,p); max=test.substring(p+1);
            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' .\n'; }
    } if (errors) alert('Renseigner les champs suivants:\n'+errors);
    document.MM_returnValue = (errors == '');
} }
//-->
</script>
</head>
 
<body>
	<div class="content_form">
	  <h1>Contact</h1>
		<form name="contact" action="valid_contact.php">
			<table width="400" border="0" align="center" cellpadding="1" cellspacing="1">
			  <tr>
				<td width="186">Nom</td>
				<td width="207"><input type="text" name="nom" id="nom" /></td>
			  </tr>
			  <tr>
				<td>Prénom</td>
				<td><input type="text" name="prenom" id="prenom" /></td>
			  </tr>
			  <tr>
				<td>E-mail</td>
				<td><input name="email" type="text" id="email" onblur="MM_validateForm('email','','RisEmail');return document.MM_returnValue" /></td>
			  </tr>
			  <tr>
				<td valign="top">Message</td>
				<td><textarea name="message" id="message" cols="45" rows="5"></textarea></td>
			  </tr>
			  <tr>
				<td>&nbsp;</td>
				<td><input name="envoyer" type="submit" id="envoyer" onclick="MM_validateForm('nom','','R','email','','RisEmail','message','','RisEmail');return document.MM_returnValue" value="Envoyer" /></td>
			  </tr>
			</table>
		</form>
 
	</div>
</body>
</html>

et voici le deuxieme code :
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
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
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Contact</title>
<link rel="stylesheet" href="css/main.css" />
<script type="text/javascript">
<!--
	function verifMail(email)
	{
	   var regex = /^[a-zA-Z0-9._-]+@[a-z0-9._-]{2,}\.[a-z]{2,4}$/;
	   if(!regex.test(email.value))
	   {
		  surligne(email, true);
		  return false;
	   }
	   else
	   {
		  surligne(email, false);
		  return true;
	   }
	}
 
	function verifForm(f)
	{
	   var mailOk = verifMail(f.email);
 
	   if(mailOk)
		  return true;
	   else
	   {
		  alert("Veuillez remplir correctement le champ Email !!");
		  return false;
	   }
	}
//-->
</script>
</head>
 
<body>
	<div class="content_form">
	  <h1>Contact</h1>
		<form name="contact" action="valid_contact.php  onsubmit="return verifForm(this)"">
			<table width="400" border="0" align="center" cellpadding="1" cellspacing="1">
			  <tr>
				<td width="186">Nom</td>
				<td width="207"><input type="text" name="nom" id="nom" /></td>
			  </tr>
			  <tr>
				<td>Prénom</td>
				<td><input type="text" name="prenom" id="prenom" /></td>
			  </tr>
			  <tr>
				<td>E-mail</td>
				<td><input name="email" type="text" id="email" onblur="verifMail(this)" /></td>
			  </tr>
			  <tr>
				<td valign="top">Message</td>
				<td><textarea name="message" id="message" cols="45" rows="5"></textarea></td>
			  </tr>
			  <tr>
				<td>&nbsp;</td>
				<td><input name="envoyer" type="submit" id="envoyer" value="Envoyer" /></td>
			  </tr>
			</table>
		</form>
 
	</div>
</body>
</html>

Merci de bien vouloir �clairer ma lanterne sur ces d�fauts SVP, merci d'avance.