Alright, I found this code:
<script type="text/javascript"><!--
var wordLen = 255; // Maximum word length
function checkWordLen(obj){
var len = obj.value.split(/[\s]+/);
if(len.length > wordLen){
alert("You cannot put more than "+wordLen+" words in this text area.");
obj.oldValue = obj.value!=obj.oldValue?obj.value:obj.oldValue;
obj.value = obj.oldValue?obj.oldValue:"";
return false;
}
return true;
}
//--></script>
and for the textarea:
<textarea rows="15" cols="30" name="t1" onchange="checkWordLen(this);"></textarea>
(I know the pop-up would be annoying but, it would prevent readers posting mile long comments.)
The above code almost works. But, after you hit the submit button WordPress still accepts the comment after getting the notice that you have entered too many words. Could anyone help me implement this code so it is functional with WordPress? Or is there an alternative script I can use?
Thanks in advanced.