je vais m'arracher les cheveux ....

quelqu'un peut me dire pourquoi ma fonction est appelé lorsque j'appuis sur la touche entrée dans mon champs input ??

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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
		<title>Untitled Document</title>
	</head>
	<body>
			<form action="www.google.fr" onsubmit="verif()">
			<input type="submit" value="post">
			<input type="submit" value="post">
			<input type="submit" value="post">
			<input type="submit" value="post">
			<input type="submit" value="post">
			<input type="text" value="post">
			</form>
		<script type="text/javascript">
			var cible = false;
			function init(){
				var lstInput = document.getElementsByTagName('input');
 
				for(var i = 0 , l = lstInput.length ; i <l ; i++){
 
					if(lstInput[i].type == 'submit'){
						var u=function(inputCible){
												return function(){
													cible = true;
													}
											}(lstInput[i]);
						lstInput[i].onclick = u;
					}
				}
			}
			function verif(){
				alert(cible);
				return cible;
			}
 
			window.onload = init();
		</script>
	</body>
</html>