Add this script anywhere in the page (i.e. in the <head> section):
<script>
function chkWordCnt(tbox)
{
// eliminate multiple white spaces
// eliminate leading and trailing white spaces
tbox.value = tbox.value.replace(/\s+/g," ");
tbox.value = tbox.value.replace(/(^\s+)|(\s+$)/g,"") ;
words = tbox.value.split(" ");
if ((words.length < 2) || (words.length > 4))
{
alert("You must specify two to four words.")
tbox.focus();
}
}
</script>
and then add the following attribute to your text box:
<input type="text" onblur="chkWordCnt(this);" ...>
As stated, this demands two to four words. If you want a different number of
words, update the "if" and "alert" statements accordingly.
If the box shouldn't be blank, check that using standard FrontPage form
field validation.
Jim Buyens
Microsoft MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Windows SharePoint Services Inside Out
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------