Du laver godt nok en pudsig if/else konstruktion, men dette burde virke:
<script type="text/JavaScript">
<!--
function valider ( form ) {
if ( form.firma.value.length > 0 ) {
} else {
alert ("Company name required.");
form.firma.focus();
return false;
};
if ( form.navn.value.length > 0 ) {
} else {
alert ("Name required.");
form.navn.focus();
return false;
};
if ( form.adresse.value.length > 0 ) {
} else {
alert ("Address required.");
form.adresse.focus();
return false;
};
if ( form.postnr.value.length > 0 ) {
} else {
alert ("Postal code required.");
form.postnr.focus();
return false;
};
if ( form.by.value.length > 0 ) {
} else {
alert ("City required.");
form.by.focus();
return false;
};
if ( form.country.value.length > 0 ) {
} else {
alert ("Country required.");
form.country.focus();
return false;
};
if ( form.tel.value.length > 0 ) {
} else {
alert ("Phone required.");
form.tel.focus();
return false;
};
else if (!(/^[0-9]+$/).test(form.tel.value)) {
alert ("Wrong phone number format.");
form.tel.focus();
return false;
};
if ( /^[\da-z\._\-]{1,50}@[\da-z\._\-]{1,50}\.[\da-z_]{1,3}$/.test(form.mail.value) ) {
} else {
alert ("E-mail address incorrect.");
form.mail.focus();
return false;
};
return true;
};
//-->
</script>