function formvalidation() { for (i=0;i<3;i++) { box = document.contact.elements[i]; if (!box.value) { alert('You haven\'t fill in ' + '\"' + box.name + '\"' + '!'); box.focus() return false; } } document.contact.submit(); }