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
| <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Nouvelle page 1</title>
<style type="text/css">
.valid {
border: inset 2px silver:
}
.notvalid {
border: solid 2px red;
}
</style>
<script type="text/javascript">
function verif(obj){
var i=0;
var gotcha=false;
while (zone=document.getElementById('_'+ ++i)){
if(zone.value.length>0){zone.className='valid';}
else{
zone.className="notvalid"
if(!gotcha){
this.fcs=zone;
gotcha=true;
}
}
}
gotcha && this.fcs.focus()
return !gotcha
}
</script>
</head>
<body>
<form action="javascript:alert('envoyé')" onsubmit="return verif(this)" >
<input type="text" id="_1" value="" />
<input type="text" id="_2" value="" />
<input type="text" id="_3" value="" />
<input type="submit" id="_" value="go" /></form>
</body>
</html> |
Partager