function check_text(textGroup,fldname) { if (!textGroup.value) { alert(fldname + " is required! (please enter a value)"); //window.location = "#" + fldname; textGroup.focus(); return (false); } return (true); } function validate_input(pform) { if (!check_text(pform.cname, "Name")) {return (false);} if (!check_text(pform.email, "Email address")) {return (false);} if (!check_text(pform.comments, "Comments")) {return (false);} return (true); } function checkLoginForm(loginForm){ if(!loginForm.username.value) { alert("Username required."); loginForm.username.focus(); } else if(!loginForm.passwd.value) { alert("Password required."); loginForm.passwd.focus(); } else { loginForm.submit(); } }