function checkWholeForm(theForm) { var why = ""; why += checkUsername(theForm.username.value); if (why != "") { alert(why); return false; } return true; } function checkUsername(strng) { var error = ""; if (strng == "") { error = "You didn't enter a username.\n"; } }