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
|
<script type="text/javascript">
function verif(f){
for(i=0; i!= 3;i++){
f[i].value=f[i].value.replace(/^\s*(.*)\s*$/,"$1");
if(!f[i].value){
alert("champ " + f[i].title + " non rempli");
f[i].focus();
return false
}
}
}
</script>
</head>
<body>
<form id="f" action="" onsubmit="return verif(this.elements)">
<p>
<input type="text" title="login" name="log" id="log" />
<input type="password" title="mot de passe" name="pass" id="pwd" />
<input type="password" title="mot de passe (2e)" name="pass2" id="pwd2" />
</p>
<p>
<input type="submit" value="valider" />
</p>
</form> |
Partager