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
| <html>
<head>
<script type="text/javascript">
function Verif(){
var inputList=document.getElementsByTagName('input');
var t = "";
for (i=0;i<inputList.length;i++){
if(inputList[i].type=="text" && inputList[i].value.length==0){
t += "Le champ "+inputList[i].name+" n'a pas été rempli \n";
}
}
if(t.length>0){
alert(t);}
}
</script>
</head>
<body>
<form name="formuins">
Firstname: <input name="fname" type="text" />
Lastname: <input name="lname" type="text" />
</form>
<input type='button' onclick='Verif()' value='verifier' />
</p>
</body>
</html> |