I was hoping that the bold text would trap an error and exit the function.
However, the alert appears and the code continues and the form gets submitted
Is return; not the equivalent of Exit Sub?

Code:
function CheckForm(){
	//This should be the number of file upload boxes
	var intDUTs = document.frmUpload.cboDUTs.value;
    //Loop through all the file upload boxes and make sure that they have .txt or .rid extensions
	for (var i = 0; i < intDUTs; i++){
		//Get the filename from each box
		try{
			var strFile = (document.forms['frmUpload'].elements['txtFileName' + i].value);
		}
		catch(err){
			
			//alert("Please select a file for all of the devices.");
			alert("Error.");
			return;
		}
		//Check for blank fields
		// alert("strFile.length " + strFile.length);
		// alert(strFile);
		// if (strFile.length = 0 || strFile = ""){
		if (strFile.length == 0){
			alert("Please select a file for all of the devices.");
			return;
		}
		//Get the extension from the filename
		var strExt = strFile.substring(strFile.length - 3);
		//alert("strExt = " + strExt);
		//Check for RID or TXT files
		if (strExt !== 'rid' && strExt !== 'txt'){
			alert("Only data files in rid or txt can be uploaded.");
			return;		
		}
		else {
			//document.frmUpload.submit();
		} 
		document.frmUpload.submit();		
	}

}