question about whitespace

Giganews Newsgroups
Subject: question about whitespace
Posted by:  Dwayne Epps (dwayneeppsNOSP…@centurytel.net)
Date: Sun, 13 Jul 2003

I've created a function that checks form fields that only will have letters.
This is the script:

<script type="text/javascript" language="javascript">
function validateString(field, msg, min, max) {
if (!min) { min = 1 }
if (!max) { max = 65535}
if (!field.value || field.value.length < min || field.value.max > max) {
alert(msg);
field.focus();
field.select();
return false;
}
return true;
}
</script>

How can I add code to this function that checks for whitespace...ex.
"
\r\t"
I would also like to check for only letters in the fields and make sure no
numbers have been entered.  Any help is appreciated.  Thanks in advance.
-D-

Replies