function checkMe(){ var theForm = document.getElementById("speedEvtFrm"); var theChildren = theForm.getElementsByTagName("input"); var validated = true; for (child=0; child <= theChildren.length; child++) { var theChild = theChildren[child]; if (theChild.hasAttribute("class")) { var theAttr = String(theChild.getAttribute("class")); if (theAttr.indexOf("rq") > -1) { if (!theChild.value) { alert ("You forgot to fill out the, "+theChild.title); validated = false; break; } } } } alert("done!"); if (validated) { alert("sending form..."); //document.forms["speedEvtFrm"].submit(); } else { alert("not sending..."); }}