Here is a javascript example from one of the websites I have build, and underneath is the HTML snippet with the field etc.
<script>
function CountWords (this_field) {
var char_count = this_field.value.length;
var fullStr = this_field.value + " ";
var initial_whitespace_rExp = /^[^A-Za-z0-9]+/gi;
var left_trimmedStr = fullStr.replace(initial_wh
var non_alphanumerics_rExp = rExp = /[^A-Za-z0-9]+/gi;
var cleanedStr = left_trimmedStr.replace(no
var splitString = cleanedStr.split(" ");
var word_count = splitString.length -1;
if (fullStr.length <2) {
word_count = 0;
}
if (word_count == 1) {
wordOrWords = " word";
} else {
wordOrWords = " words";
}
var retstring = word_count + " " + wordOrWords
document.getElementById('w
if (word_count>200) {
if(document.layers){ document.layers["q"].bgCol
else { document.getElementById('w
} else {
if(document.layers){ document.layers["q"].bgCol
else { document.getElementById('w
}
}
</script>
<table cellspacing="2" cellpadding="2" class="bodystyle">
<tr>
<td class="formtitle">Summary<
<td><textarea name="summary" id="summary" value="" cols="35" rows="12" onKeyDown="CountWords(docu
</tr>
</table>
Main Topics
Browse All Topics





by: rkannan2000Posted on 2007-04-26 at 08:00:11ID: 18982095
check this out.. ibilities/ demo/ Maxim umFormFiel dWords/
http://willmaster.com/poss