function check() { for (i=0;i< document.shout.elements.length;i++) { var box = document.shout.elements[i]; if (!box.value) { alert('You haven\'t filled in ' + box.name + '!'); box.focus() return false; } } return true; }