Tip for examples on this page: the pattern "\s" (backslash and lowercase "s") matches whitespace, while "\S" (uppercase) matches any other character (letters, symbols, numbers, etc.)
var str = document.getElementById("comments").value; // User comments
if( /\S/.test(str) ) { // comments contain at least one letter/symbol/number
alert( "Thank you for your comments!" );
} else {
alert( "Please type some comments." );
document.getElementById("comments").focus();
}
Comments here: var zip = "*77845z"; // Expecting a 5-digit zip code...
if( ! /\D/.test(zip) ) // True if contains only numbers
document.dealerLocatorForm.submit();
Note: you'll generally want to be more helpful by (for example) first removing all non-digits (/\D/g) from user inputs using the replace() method, and then only check for valid formats. FYI, a better way to check for a zip code would be the /^\d{5}$/ pattern.