Jo, f.eks.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"
http://www.w3.org/TR/html4/loose.dtd"><html>
<head>
<title>Check alle felter for udfyldelse</title>
<meta name="Generator" content="Stone's WebWriter 4">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="javascript" type="text/javascript">
function checkForm(f){
var txt = "";
var regexp = /^[\w\.\-_]+@[\w\-_]+\.[\w\.\-_]+$/i;
for(i=0;f.elements.length>i;i++){
fld = f.elements[i]
if ((fld.tagName=='TEXTAREA'||fld.type=="text")&&fld.value==fld.defaultValue){
txt+="\n\t"+fld.name;
}else if (fld.name.toLowerCase().indexOf("mail")>-1){
if (!regexp.test(fld.value))txt+="\n\t"+fld.name+" -- ikke korrekt mail-adresse-format";
}
}
if(txt!=""){
txt = "Du mangler at udfylde disse felter:\n"+txt+"\n\nAlle felter skal udfyldes";
alert(txt);
return false;
}
return true;
}
</script>
</head>
<body>
<br>
<form id="minForm" name="minForm" action="" method="get" onsubmit="return checkForm(this);">
Input1: <input id="minInput1" name="input1" type="text" value="Tom" onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;" size="30"><br>
Input2: <input id="minInput2" name="Input2" type="text" value="Tom" onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;" size="30"><br>
Input3: <input id="minInput3" name="input3" type="text" value="Tom" onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;" size="30"><br>
E-mail: <input id="minInput4" name="Email" type="text" value="name@domain.topDomain" onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;" size="30"><br>
Kommentar: <textarea name="Kommentar" cols="80" rows="5" onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;"></textarea><br><br>
<input type="submit" value="Send data">
</form>
</body>
</html>